<?php
|
namespace JVBase\managers\SEO\render\Traits\_Properties;
|
|
use JVBase\managers\SEO\render\Thing\Intangible\ContactPoint\PostalAddress;
|
use JVBase\managers\SEO\render\Thing\Intangible\VirtualLocation;
|
use JVBase\managers\SEO\render\Thing\Place\Place;
|
use JVBase\managers\SEO\render\Traits\_Helpers\arrayHelper;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
trait locationTrait {
|
use arrayHelper;
|
/**
|
* @var Place|PostalAddress|VirtualLocation|string|array The location of, for example, where an event is happening, where an organization is located, or where an action takes place.
|
*/
|
protected Place|PostalAddress|VirtualLocation|string|array $location;
|
|
public function getLocation():Place|PostalAddress|VirtualLocation|string|array|null
|
{
|
return $this->location??null;
|
}
|
public function setLocation(Place|PostalAddress|VirtualLocation|string|array $location):void
|
{
|
if (is_array($location)){
|
$location = $this->mixedArray('location', $location, [
|
'JVBase\managers\SEO\render\Thing\Intangible\ContactPoint\PostalAddress',
|
'JVBase\managers\SEO\render\Thing\Intangible\VirtualLocation',
|
'JVBase\managers\SEO\render\Thing\Place\Place',
|
'string'
|
]);
|
}
|
$this->location = $location;
|
}
|
|
|
public function getLocationFieldConfig():array
|
{
|
return [
|
'type' => 'group',
|
'wrap' => 'details',
|
'label' => 'Address',
|
'fields' => [
|
'streetAddress' => [
|
'type' => 'text',
|
'label'=> 'Street Address',
|
'hint' => 'The street address. For example, "6551 111 St NW"'
|
],
|
'extendedAddress' => [
|
'type' => 'text',
|
'label'=> 'Extended Address',
|
'hint' => 'An address extension such as an apartment number, C/O or alternative name.'
|
],
|
'postOfficeBoxNumber' => [
|
'type' => 'text',
|
'label' => 'PO Box Number',
|
],
|
'addressLocality' => [
|
'type' => 'text',
|
'label' => 'Address Locality',
|
'hint' => 'The locality in which the street address is, and which is in the region. For example, "Park Allen".'
|
],
|
'addressRegion' => [
|
'type' => 'text',
|
'label' => 'Address Region (Province)',
|
],
|
'postalCode' => [
|
'type' => 'text',
|
'label' => 'Postal Code',
|
'hint' => 'The postal code. For example, T6H 4R5.'
|
],
|
'addressCountry' => [
|
'type' => 'text',
|
'label' => 'Country',
|
'hint' => 'The address country. For example, "CA".',
|
'default' => 'CA'
|
]
|
]
|
];
|
}
|
}
|