Problem/Motivation
Currently, it is not possible to add each opening time to a Views Calendar display.
A use case would be:
- create a calendar with office_hours for each practicioner/teacher in my department/building/school
- allow customers/clients/students to click on an instance, and book the time slot.
For this, the following modules are in scope:
Problem is that calendar views need one date instance/'occurrence' per time slot per date, where office_hours offers a timeslot per weekday.
For this, the office hours must be exploded into multiple instances/'occurrences'.
That is supported by the following modules:
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
- Maintainer 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.
- This route should be taken for each supported recurring field type
Remaining tasks
- [ ✔ ] #3584690: Move field settings to widget settings
- [ ✔ ] #3583782: Introduce OfficeHoursItemInterface.php, making use of 'Interface' typing allows subclassing
- [ ✔ ] Make office_hours.js compatible with all field_types
- [ ✔ ] Adapt
ComplexWidget; callsrc/OfficeHoursItemListFactory.php, to instantiate per-contrib-module a 2-way conversion between 'office_hours' and the contrib module - [ ✔ ] For each supported field, create
src/Plugin/DataType/OfficeHours<TYPE>ItemList.php, an ItemList wrapper class and translator class for 2-way conversion between 'office_hours' and contrib field_type - [ ] Make formatter independent of 'office_hours' field type
- [ ] Test/fix formatter in views display (also for 'normal' Office Hours field type)
User interface changes
- Office Hours field settings are moved into widget settings.
- Office Hours Complex widget is also compatible with date_recur field.
Comments
Comment #2
johnvComment #3
johnvComment #4
johnv