| | |
| | | |
| | | public function setOpeningHoursSpecificationField(Fields $fields):void |
| | | { |
| | | $fields->addField('openingHours', [ |
| | | 'type' => 'repeater', |
| | | 'label' => 'Opening Hours', |
| | | 'fields' => [ |
| | | 'dayOfWeek' => [ |
| | | 'type' => 'set', |
| | | 'label' => 'Day(s) of Week', |
| | | 'options' => [ |
| | | 'Mo' => 'Monday', |
| | | 'Tu' => 'Tuesday', |
| | | 'We' => 'Wednesday', |
| | | 'Th' => 'Thursday', |
| | | 'Fr' => 'Friday', |
| | | 'Sa' => 'Saturday', |
| | | 'Su' => 'Sunday' |
| | | $days = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday']; |
| | | $dayFields = []; |
| | | foreach ($days as $day) { |
| | | $slug = strtolower($day); |
| | | |
| | | $dayFields[$slug] = [ |
| | | 'type' => 'group', |
| | | 'label' => $day, |
| | | 'fields' => [ |
| | | 'isOpen' => [ |
| | | 'type' => 'true_false', |
| | | 'label' => 'Open', |
| | | ], |
| | | 'required' => true |
| | | 'opens' => [ |
| | | 'type' => 'time', |
| | | 'label' => 'Opens at', |
| | | 'required' => true |
| | | ], |
| | | 'closes' => [ |
| | | 'type' => 'time', |
| | | 'label' => 'Closes at', |
| | | 'required' => true |
| | | ] |
| | | ], |
| | | 'opens' => [ |
| | | 'type' => 'time', |
| | | 'label' => 'Opens at', |
| | | 'required' => true |
| | | ], |
| | | 'closes' => [ |
| | | 'type' => 'time', |
| | | 'label' => 'Closes at', |
| | | 'required' => true |
| | | ] |
| | | ] |
| | | 'section' => 'hours', |
| | | ]; |
| | | } |
| | | $fields->addField('openingHours', [ |
| | | 'type' => 'group', |
| | | 'label' => 'Opening Hours', |
| | | 'fields' => $dayFields, |
| | | 'section' => 'hours', |
| | | ]); |
| | | $fields->addField('by_appointment', [ |
| | | 'type' => 'true_false', |
| | | 'label' => 'By Appointment Only', |
| | | 'section' => 'hours', |
| | | ]); |
| | | $fields->addField('allow_walkins', [ |
| | | 'type' => 'true_false', |
| | | 'label' => 'Walk Ins Welcome' |
| | | 'label' => 'Walk Ins Welcome', |
| | | 'section' => 'hours', |
| | | ]); |
| | | } |
| | | public function formatOpeningHoursSpecificationField(Meta $meta):void |