Jake Vanderwerf
2026-03-03 772462eeca3002a1d52508aeba485aab2b4742ad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace JVBase\managers\SEO\render\Traits\_Properties;
 
use JVBase\managers\SEO\render\Thing\Intangible\StructuredValue\OpeningHoursSpecification;
 
if (!defined('ABSPATH')) {
    exit;
}
trait specialOpeningHoursTrait {
    /**
     * @var OpeningHoursSpecification The special opening hours of a certain place.
     *
     * Use this to explicitly override general opening hours brought in scope by specialOpeningHours or openingHours.
     */
    protected OpeningHoursSpecification $specialOpeningHours;
 
    public function getSpecialOpeningHours():?OpeningHoursSpecification
    {
        return $this->specialOpeningHours??null;
    }
    public function setSpecialOpeningHours(OpeningHoursSpecification $specialOpeningHours):void
    {
        $this->specialOpeningHours = $specialOpeningHours;
    }
 
    public function getSpecialOpeningHoursFieldConfig():array
    {
        return [
            'type'  => 'repeater',
            'label' => 'Special Opening Hours',
            'fields'    => [
                'closed'    => [
                    'type'  => 'true_false',
                    'label' => 'Is closed',
                ],
                'dayOfWeek' => [
                    'type'  => 'radio',
                    'label' => 'Day(s) of Week',
                    'options'   => [
                        'Mo'    => 'Monday',
                        'Tu'    => 'Tuesday',
                        'We'    => 'Wednesday',
                        'Th'    => 'Thursday',
                        'Fr'    => 'Friday',
                        'Sa'    => 'Saturday',
                        'Su'    => 'Sunday'
                    ]
                ],
                'opens' => [
                    'type'  => 'time',
                    'label' => 'Opens At',
                ],
                'closes'    => [
                    'type'  => 'time',
                    'label' => 'Closes At',
                ],
            ],
            'hint'  => 'Special opening hours that override existing hours.'
        ];
    }
}