| | |
| | | <?php |
| | | namespace JVBase\managers\SEO\render\Traits\_Properties; |
| | | |
| | | use JVBase\managers\SEO\render\Thing\Intangible\OfferCatalog; |
| | | use JVBase\base\SchemaHelper; |
| | | use JVBase\inc\managers\SEO\render\Thing\Intangible\ItemList\OfferCatalog; |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | |
| | | { |
| | | return $this->hasOfferCatalog??null; |
| | | } |
| | | public function setHasOfferCatalog(OfferCatalog $hasOfferCatalog):void |
| | | public function setHasOfferCatalog(OfferCatalog|array $hasOfferCatalog):void |
| | | { |
| | | if (is_array($hasOfferCatalog)){ |
| | | if (array_key_exists('generate', $hasOfferCatalog) && $hasOfferCatalog['generate']) { |
| | | $this->generateOfferCatalog($hasOfferCatalog); |
| | | } else { |
| | | if (!array_key_exists('type', $hasOfferCatalog)) { |
| | | $hasOfferCatalog['type'] = 'JVBase\inc\managers\SEO\render\Thing\Intangible\ItemList\OfferCatalog'; |
| | | } |
| | | $items = []; |
| | | if (array_key_exists('items', $hasOfferCatalog)) { |
| | | $items = $hasOfferCatalog['items']; |
| | | unset($hasOfferCatalog['items']); |
| | | } |
| | | $hasOfferCatalog = SchemaHelper::classFromConfig($hasOfferCatalog); |
| | | if (!empty($items)) { |
| | | $hasOfferCatalog->setItemListElement($items); |
| | | } |
| | | } |
| | | } |
| | | $this->hasOfferCatalog = $hasOfferCatalog; |
| | | } |
| | | |
| | |
| | | 'fields' => [ |
| | | 'generate' => [ |
| | | 'type' => 'true_false', |
| | | 'label' => 'Generate from Content type?' |
| | | 'label' => 'Generate from Content type?', |
| | | 'default' => false, |
| | | ], |
| | | 'content_type' => [ |
| | | 'type' => 'checkbox', |
| | |
| | | 'description' => [ |
| | | 'type' => 'textarea', |
| | | 'label' => 'Description' |
| | | ], |
| | | 'price' => [ |
| | | 'type' => 'number', |
| | | 'label' => 'Price' |
| | | ] |
| | | ] |
| | | ] |