- Issue created by @hktang
- First commit to issue fork.
- πΊπΈUnited States dcam
I verified that
hook_fullcalendar_process_dates_alter()
is non-functional. In the D7 versions this alter hook was invoked in the theme.inc file. It looks like that file was removed and split up during the D8 upgrade. During that process the hook invocation was lost and forgotten.I restored the invocation, but felt like I had to update its definition. This is a BC break, but BC is broken already and has been for years. I don't think it matters and shouldn't require a new major version. Anyway, the new hook definition works better with
FullCalendar::prepareEvent()
because I can just plug in existing variables. I think that the context information delivers the same information that it did in D7, just maybe not quite as conveniently, i.e. the field info would have to be extracted from the fields array.Anyway, I was able to successfully create a hook implementation with the code I've provided in the MR.
I'm setting the priority to Major since this bug renders the hook unusable with no workaround.
- πΊπΈUnited States dcam
I hid MR 58 because there was something wrong with it. I think it was caused by me opening the MR while the issue version was set to 3.0.2. MR 59 was properly created from the 3.1.x branch.
- Status changed to Needs review
1 day ago 3:09pm 6 June 2025 - First commit to issue fork.
- π¨π¦Canada mandclu
As discussed over Slack, let's keep the start and end dates separate in the API instead of passing them within an array.
- Merge request !66Updated the hook re-implementation based on Slack discussion β (Open) created by dcam
- πΊπΈUnited States dcam
This ended up being more complicated than I expected. The inherent problem is that the hook which came from D7 passed
\DateTime
objects. But the modern code mostly deals with datetime strings. It wouldn't be quite as much of a problem if it weren't for the all-day handling. In the end, the simplest thing to do was to change the hook's definition to have the date strings passed instead of objects. We could try to convert everything to use objects instead, but it would force a major refactoring of the code, I think. It makes me wonder if this is how the hook got lost in the first place.In case you're curious, I think the reason I left the dates in their array was due to a strict reading of the
ModuleHandler::alter()
docs. It only allows three parameters to be passed to implementations:$data
,$context1
, and$context2
. I'm a very literal person, so I thought "Oh, I should put both dates in the$data
variable. And that works out because the entity and fields can be the context variables." But I don't think it really matters. - πΊπΈUnited States dcam
For the record, this updated hook is working for me with the implementation I'd already set up to give end times to events that only had start dates - after updating the implementation of course.
- π¨π¦Canada mandclu
Thanks for the additional work. This looks great, but I do wonder if we need to pass by reference in the API example. If we can get that cleared up, this should be good to merge.
- πΊπΈUnited States dcam
Glad you caught that. Thank you for doing a thorough review of it.