| | |
| | | 'label' => 'Description', |
| | | ] |
| | | ]; |
| | | if ($this->registrar->args()['hierarchical']??false && $this->registrar->args()['hierarchical'] === true){ |
| | | if ($this->registrar->args()['hierarchical']??false){ |
| | | $fields['parent'] = [ |
| | | 'type' => 'taxonomy', |
| | | 'isReference' => true, |
| | |
| | | |
| | | public function modifyField(string $name, string $property, mixed $value):void |
| | | { |
| | | $property = 'set'.implode('',array_map('ucfirst',explode('_', $property))); |
| | | $field = $this->fields[$name]; |
| | | $field->$property = $value; |
| | | $field->$property($value); |
| | | } |
| | | |
| | | public function getFields():array |
| | |
| | | |
| | | public function addCommon(string $name):self |
| | | { |
| | | match ($name) { |
| | | 'wiki' => $this->addWikiField(), |
| | | 'links' => $this->addLinksField(), |
| | | 'contact' => $this->addContactField(), |
| | | 'reviews', 'review' => $this->addReviewField(), |
| | | 'alternate_name' => $this->addAlternateName(), |
| | | 'keywords' => $this->addKeywords(), |
| | | default => error_log('[Field]addCommon: No configuration found for '.$name.'.') |
| | | }; |
| | | $method = 'add'.implode('',array_map('ucfirst',explode('_', $name))).'Field'; |
| | | if (method_exists($this, $method)) { |
| | | $this->$method(); |
| | | } else { |
| | | error_log('[Field]addCommon: No configuration found for '.$name.'.'); |
| | | } |
| | | return $this; |
| | | } |
| | | |
| | | protected function addWikiField():void |
| | | protected function addWikiField(?string $label = null):void |
| | | { |
| | | $this->addField( |
| | | 'wiki', |
| | | [ |
| | | 'type' => 'url', |
| | | 'label' => 'Wikipedia Page', |
| | | 'label' => $label ?: 'Wikipedia Page', |
| | | 'description' => 'For the schema', |
| | | 'quickEdit' => true, |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | protected function addLinksField():void |
| | | protected function addLinksField(?string $label = null):void |
| | | { |
| | | $this->addField( |
| | | 'links', |
| | |
| | | 'type' => 'repeater', |
| | | 'quickEdit' => true, |
| | | 'add_label' => 'title', |
| | | 'label' => 'Online Links', |
| | | 'label' => $label ?:'Online Links', |
| | | 'description' => 'These are listed publicly on the website', |
| | | 'fields' => [ |
| | | 'url' => [ |
| | |
| | | 'type' => 'text', |
| | | 'label' => 'Tracker', |
| | | 'description' => 'If you are set up to track link referrals, add what comes after the ? here.', |
| | | 'default' => 'ref=edmonton_ink' |
| | | ], |
| | | ], |
| | | 'section' => 'contact' |
| | |
| | | ); |
| | | } |
| | | |
| | | protected function addReviewField():void |
| | | protected function addReviewField(?string $label = null):void |
| | | { |
| | | $this->addField( |
| | | 'reviews', |
| | | [ |
| | | 'type' => 'repeater', |
| | | 'add_label' => 'name', |
| | | 'label' => 'Reviews', |
| | | 'label' => $label ?: 'Reviews', |
| | | 'fields' => [ |
| | | 'name' => [ |
| | | 'type' => 'text', |
| | |
| | | ); |
| | | } |
| | | |
| | | protected function addAlternateName():void |
| | | protected function addAlternateNameField():void |
| | | { |
| | | $this->addField( |
| | | 'alternate_name', |
| | |
| | | ] |
| | | ); |
| | | } |
| | | protected function addKeywords():void |
| | | protected function addKeywordsField():void |
| | | { |
| | | $this->addField( |
| | | 'keywords', |
| | |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | protected function addOutsidePhotoField():void |
| | | { |
| | | $this->addField( |
| | | 'outside_photo', |
| | | [ |
| | | 'type' => 'image', |
| | | 'limit' => 1, |
| | | 'label' => __('Outside Photo', 'jvb') |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | protected function addSloganField():void |
| | | { |
| | | $this->addField( |
| | | 'slogan', |
| | | [ |
| | | 'type' => 'text', |
| | | 'label' => __('Tagline or Slogan', 'jvb') |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | protected function addPaymentField():void |
| | | { |
| | | $this->addField( |
| | | 'payment_accepted', |
| | | [ |
| | | 'type' => 'set', |
| | | 'label' => __('Payment Accepted', 'jvb'), |
| | | 'options' => [ |
| | | 'Cash' => 'Cash', |
| | | 'Credit Card' => 'Credit Card', |
| | | 'Debit' => 'Debit', |
| | | 'Google Pay' => 'Google Pay', |
| | | 'Apple Pay' => 'Apple Pay', |
| | | 'PayPal' => 'PayPal', |
| | | 'Interac' => 'Interac', |
| | | 'AMEX' => 'AMEX', |
| | | ], |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | protected function addAmenitiesField():void |
| | | { |
| | | $this->addField( |
| | | 'amenities', |
| | | [ |
| | | 'type' => 'set', |
| | | 'label' => __('Amenities', 'jvb'), |
| | | 'options' => [ |
| | | 'Wheelchair Accessible' => 'Wheelchair Accessible', |
| | | 'Free Parking' => 'Free Parking', |
| | | 'Private Rooms' => 'Private Rooms', |
| | | 'Air Conditioning' => 'Air Conditioning', |
| | | 'WiFi' => 'WiFi', |
| | | 'Gender Neutral Restroom' => 'Gender Neutral Restroom', |
| | | 'LGBTQ+ Friendly' => 'LGBTQ+ Friendly', |
| | | 'Sterilization Room' => 'Sterilization Room', |
| | | 'Refreshments Available' => 'Refreshments Available', |
| | | 'Street Level Access' => 'Street Level Access', |
| | | 'Single Use Needles' => 'Single Use Needles', |
| | | 'Consultation Room' => 'Consultation Room', |
| | | 'Aftercare Products Available' => 'Aftercare Products Available', |
| | | 'Walk-Ins Welcome' => 'Walk-Ins Welcome', |
| | | ] |
| | | ] |
| | | ); |
| | | } |
| | | } |