The widget is now in. Feel free to test, comment and contribute!
Problem/Motivation
This is part of #3585605: Add support for *Calendar* Views displays
Currently, it is not possible to add each opening time to a Views Calendar display.
For this, the office hours must be exploded into multiple instances.
That is supported by the Recurring Dates Field.
The module date_recur is now supported in the Calendar module:
#2820803: Support Recurring Dates Field in Calendar 8.x-1.x
#3127308: Support Recurring Dates Field in Calendar 8.x-2.x
Steps to reproduce
Create node type with a field type supporting office_hours module (widget)
- add a node with office hours, add the following minimal timeslots:
-- each monday from 09:00-17:00 (regular week with 1 timeslot)
-- next tuesday from 11:00-12:00 (exception date with 2 timeslots)
-- next tuesday from 14:00-15:00 (exception date with 2 timeslots)
-- each friday the rest of the month from 09:00-17:00 (season week with 1 timeslot)
- create a calendar view, (add a relationship), add office_hours field (via relationship).
- display the view. Each time slot should appear on the correct day with the correct start/end time.
Proposed resolution
- It is tried to save office_hours data as date_recur 'Occurrences'. But there was too much code copying involved.
- Instead, the route has been selected to adapt the office_hour widget also for date_recur fields.
Remaining tasks
- [ ✔ ] #3585605: Add support for *Calendar* Views displays
- [ ✔ ] Create
src/Plugin/DataType/OfficeHoursDateRecurItemList.php, an ItemList wrapper class and adaptor class for 2-way conversion between 'office_hours' and 'date_recur' - [ ] Fix features: timezone handling in widget saving
- [ ] Fix features in widget settings: E.g., now not possible to leave end time empty; all_day is not tested
- [ ] Fix features in widget settings: Add missing support for time slot comments and season title
- [ WIP ] Create
src/EventSubscriber/DateRecurEventSubscriber.php, to override default DateRecur::onSave() event to respect exception date > season > regular week priority. NOTE. This is now disable with a one-line code, until a mechanism is in place to not unwillingly override current logic. - [ ] Adapt formatter
- [ ] Fix CI errors in : Pipelines
Comments
Comment #3
johnvComment #4
johnvComment #5
johnvComment #7
johnvComment #9
johnvThe widget is now in. Feel free to test, comment and contribute!
Comment #12
johnvComment #13
johnvComment #15
johnvComment #17
johnvComment #25
johnvSorry for the Lots of commits. I do not seem to get rid of the CI errors, now that I have committed the date_recur adapter.
I now created a submodule, which makes the functionality a bit more prominent and switchable, but that should not be necessary, all all objects being pluggable.
Any help is appreciated.