Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Do we granularity in Drupal\calendar\Plugin\views\argument\CalendarDate any more.
In the new submodule calendar_datetime we have brought in the arguments for
- Date in the form of YYYY.
- Date in the form of YYYYMM.
- Date in the form of CCYYMMDD.
from #2567815: Add week, date, and year-month Views argument plugins
This will be in core in 8.1 also hopefully.
Maybe we don't need CalendarDate at all?
Comment | File | Size | Author |
---|---|---|---|
#7 | calendar-remove_calendardate_arg-2620898-7.patch | 22.89 KB | tedbow |
Comments
Comment #2
tedbowChanging this to Major because it effect a lot of other code
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedActually it's possible that we'll have the bugfix part of the patch sooner, see #2567815: Add week, date, and year-month Views argument plugins.
As for the CalendarDate argument handler, that was added specifically to make granularity and range options available on the handler. They serve as a fallback. Looking at the 7.x version of the handler, I think there are several more options available. So I don't think we can drop it altogether.
Comment #4
tedbowSorry getting my head around this what do you mean by fallback. It seems that if used the specific handler for granularity then they won't need to be on the handler options because by selecting the appropriate argument you won't need them on the options form. But I am probably missing something.
Comment #5
tedbowThere are some strange options on date_views_argument_handler in D7 that I wonder we should rethink.
For instance Date field(s) which allows you to select multiple date fields
In D7 you added the date argument and then select the field or fields. We as so far in D8 version we have an argument per field made dynamically so selecting multiple fields won't work.
Also the selecting multiple fields for 1 contextual filter makes Date arguments work different then all other contextual filters.
Comment #6
tedbowA couple things I am seeing in #2567815: Add week, date, and year-month Views argument plugins
It doesn't actually provide all the granularity arguments we need. What it core would provide with this patch is:
The 'week' is not really useable for calendar purposes because it doesn't contain the year. Unless the label is wrong.
For the others we could use these. If need CalendarDate argument but want to use the extra arguments types above we would have to make a class for each formats CCYYMMDD, YYYYMM, and YYYY. Because now CalendarDate extends \Drupal\views\Plugin\views\argument\Date. Since each of the listed formats has it's own class then we would have to CalendarDate SubClasses for each.
For instance for Contains \Drupal\calendar_datetime\Plugin\views\argument\YearMonthDate we would need \Drupal\calendar\Plugin\views\argument\YearMonthCalendarDate.
Does that sound right?
If so we would need to change both hook implementations in calendar.views.inc to instead of making 1 calendar contextual filter for each to actually have 1 contextual filter for each granularity.
Comment #7
tedbowOk after talk with @pjonckiere and @geertvd we figured that we don't actually need the Calendar date class. For now we will use arguments that are in calendar_datetime which are copied from this core patch #2567815: Add week, date, and year-month Views argument plugins
Hopefully the arguments will be include in core 8.1 then we will not need special arguments in this module.
This patch updates calendar_datetime and removes \Drupal\calendar\Plugin\views\argument\CalendarDate class.
There are still problems and this probably creates others.
Known problems
Comment #8
tedbowOk committed to this issue. Closing since removed CalendarDate argument class
Comment #10
tedbowFollow up issue for week #2624464: Create Year Week date argument
Comment #11
tedbowFollow to fix view template #2624470: Fix "from template" functionality for Date Fields(non-base)