From 3baf3d2545ba6ece6b74a64c0def59bd0774cf54 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 10 Jun 2026 16:34:12 +0000
Subject: [PATCH] =Laid the groundwork for an improved DashboardManager.php setup. Have to put it aside so I can get the dang Northeh done though.
---
inc/managers/SEO/render/Traits/_Properties/amenityFeatureTrait.php | 63 ++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/inc/managers/SEO/render/Traits/_Properties/amenityFeatureTrait.php b/inc/managers/SEO/render/Traits/_Properties/amenityFeatureTrait.php
index 3a72e23..d188897 100644
--- a/inc/managers/SEO/render/Traits/_Properties/amenityFeatureTrait.php
+++ b/inc/managers/SEO/render/Traits/_Properties/amenityFeatureTrait.php
@@ -2,7 +2,10 @@
namespace JVBase\managers\SEO\render\Traits\_Properties;
use JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\LocationFeatureSpecification;
+use JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\PropertyValue;
use JVBase\managers\SEO\render\Traits\_Helpers\arrayHelper;
+use JVBase\meta\Meta;
+use JVBase\registrar\Fields;
if (!defined('ABSPATH')) {
exit;
@@ -26,15 +29,61 @@
$this->amenityFeature = $amenityFeature;
}
- public function getAmenityFeatureFieldConfig():array
+ public function setAmenityFeatureField(Fields $fields):void
{
- return [
- 'type' => 'repeater',
- 'label' => 'Amenity Feature',
- 'hint' => 'An amenity feature (e.g. a characteristic or service) of the Accommodation. This generic property does not make a statement about whether the feature is included in an offer for the main accommodation or available at extra costs.',
- 'fields' => [
-
+ $fields->addField('amenityFeature', [
+ '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',
]
+ ]);
+ }
+
+ public function formatAmenityFeatureField(Meta $meta):void
+ {
+ $amenities = $meta->get('amenityFeature');
+
+ $properties = [
+ 'Walk-Ins Welcome',
+ 'LGBTQ+ Friendly',
];
+
+ if (!empty($amenities)) {
+ $out = [];
+ $prop = [];
+ foreach ($amenities as $amenity) {
+ if (in_array($amenity, $properties)) {
+ $pr = new PropertyValue();
+ $pr->setName($amenity);
+ $pr->setValue(true);
+ $prop[] = $pr;
+ } else {
+ $am = new LocationFeatureSpecification();
+ $am->setName($amenity);
+ $am->setValue(true);
+ $out[] = $am;
+ }
+ }
+ if (!empty($out)) {
+ $this->setAmenityFeature($out);
+ }
+ if (!empty($prop)) {
+ $this->setAdditionalProperty($prop);
+ }
+ }
}
}
--
Gitblit v1.10.0