- Issue created by @jurgenhaas
- Merge request !74Issue #3410547: New views filter for date range containing, starting or ending at giving value → (Merged) created by jurgenhaas
- 🇩🇪Germany jurgenhaas Gottmadingen
The MR contains the first use case. The views data for the daterange field needs to be defined, of course:
$data['apbs_allocation']['daterange']['filter'] = [ 'field_name' => 'daterange_contains', 'id' => 'date_range_contains', 'title' => 'Date range contains', ];
I'll work on the second case later, but wanted to leave the WIP for review.
- Status changed to Needs review
over 1 year ago 9:01am 23 December 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
The second use case is now implemented as well. In addition to that, I've also implemented min and max values as well, so that it is similar to the parent date filter. Ready for review now.
- 🇩🇪Germany jurgenhaas Gottmadingen
An additional thought: with the 2 filter plugins, the existing date filter and the new one from the MR, we now have quite a bit of redundant code, which could be refactored. That could make maintenance a lot easier eventually. Please let me know if you're up for the idea, I could then come up with a proposal.
- 🇨🇦Canada mandclu
@jurgenhaas I can see what you mean about the duplication. I'm guessing you have in mind something like a base class that both filters could extend.
Whatever it is, I'm open to suggestions on how to make it more maintainable.
- 🇩🇪Germany jurgenhaas Gottmadingen
@mandclu we don't even need a separate base class since the
Date
plugin is already the base class for the newDateRangeContains
plugin.I've now updated the MR by introducing the
\Drupal\smart_date\Plugin\views\filter\Date::getMinAndMax
callback to do all the heavy lifting for theop*
callbacks that prepare the values for the query conditions. - 🇨🇦Canada mandclu
@jurgenhaas overall this looks great. I did raise a couple of questions. If we can get those resolved I believe this should be ready to merge in.
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @mandclu for your review. I've responded to your comments and I believe the threads could be resolved, and did so. Please re-open if you believe otherwise.
- 🇨🇦Canada mandclu
@jurgenhaas it seems I needed more coffee before my review. I do have one additional comment, please let me know your thoughts.
- 🇩🇪Germany jurgenhaas Gottmadingen
@mandclu good catch. I also found 2 other left-overs and fixed them as well. Should be good to go now, except for one question I left in that last thread in the MR.
- 🇩🇪Germany jurgenhaas Gottmadingen
@mandclu it looks like there is only one thread left open, any chance we could get this addressed at some point?
- 🇨🇦Canada mandclu
Thanks for the reminder! Let me get my head around this again and I'm sure we can get this into the next (hopefully stable) release.
- 🇨🇦Canada mandclu
I added a comment to the existing thread, and also added one new comment. Very close now.
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks @mandclu, I've closed the older thread and commented to the new one but left it open in case I got it wrong.
- 🇨🇦Canada mandclu
All the threads are resolved, and I cleaned up a couple of other things I found. I'm going to do some testing and then merge this in as long as everything works as expected.
-
mandclu →
committed c7352139 on 4.1.x authored by
jurgenhaas →
Issue #3410547 by jurgenhaas, mandclu: New views filter operators for...
-
mandclu →
committed c7352139 on 4.1.x authored by
jurgenhaas →
- Status changed to Fixed
12 months ago 10:13am 24 April 2024 - 🇩🇪Germany jurgenhaas Gottmadingen
This is exciting, thanks @mandclu for helping me and even considering this enhancement.
Automatically closed - issue fixed for 2 weeks with no activity.