| | |
| | | namespace JVBase\managers\SEO\render\Traits\_Properties; |
| | | |
| | | use JVBase\managers\SEO\render\DataType\Date; |
| | | use JVBase\meta\Meta; |
| | | use JVBase\registrar\Fields; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | |
| | | 'hint' => 'IMPORTANT: Do not fill this out, unless your business has actually closed.' |
| | | ]; |
| | | } |
| | | public function setDissolutionDateField(Fields $fields):void |
| | | { |
| | | $fields->addField( |
| | | 'permanently_close', |
| | | [ |
| | | 'type' => 'true_false', |
| | | 'label' => __('Permanently Close', 'jvb'), |
| | | 'hint' => '*IMPORTANT* This signals to search engines that this business is no longer in business. Use only if your shop is closing!', |
| | | ] |
| | | ); |
| | | $fields->addField( |
| | | 'dissolution_date', |
| | | [ |
| | | 'type' => 'date', |
| | | 'label' => __('Dissolution Date', 'jvb'), |
| | | 'condition' => [ |
| | | 'field' => 'permanently_close', |
| | | 'operator' => '==', |
| | | 'value' => true, |
| | | ] |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | public function formatDissolutionDateField(Meta $meta):void |
| | | { |
| | | [$closed, $dissolution] = $meta->getAll(['permanently_close', 'dissolution_date']); |
| | | if (!empty($closed) && $closed === true) { |
| | | if (!empty($dissolution)) { |
| | | $this->setDissolutionDate($dissolution); |
| | | } |
| | | } |
| | | } |
| | | } |