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.
As the different widgets look completely different, and themers may want to style them differently, it would be nice to have template suggestions based on widget type.
While we're at it, the ability to override for a single facet would probably be useful too.
So something like:
- facets-item-list--WIDGET_TYPE--FACET_ID
- facets-item-list--WIDGET_TYPE
- facets-item-list
Comments
Comment #2
borisson_That's a solid idea.
Comment #3
joachim CreditAttribution: joachim at Torchbox commentedPatch coming.
Comment #4
joachim CreditAttribution: joachim at Torchbox commentedHere's the patch.
I've added a helper method to the widget base class, to prevent repetition in the date widget (and other widgets to come...).
There's one more instance of '#theme' => 'facets_item_list' in buildListItems(), which I'm not sure about. It appears to be for nested lists, so I don't know if it makes sense to have the suggestion there too -- I don't know enough about this to be sure.
Also, buildListItems() doesn't have the $facet available, so to add them here we'd need to change its signature to get the $facet object passed in.
Happy to reroll if you want it adding there too.
Comment #5
borisson_I'm not sure if it's needed inside the buildListItems, for consistency I'd say we should.
Comment #6
joachim CreditAttribution: joachim at Torchbox commentedUpdated patch.
Changes since the last patch:
- docs
- fix semicolon
- Added facet param to build item list
- added theme suggestions to build item list
- fixed closure
Patch and interdiff created by Dorgflow.
I've filed #2896412: ArrayWidget::buildListItems() should use inheritdoc tag in passing, and added the parameter to the repeated docs in ArrayWidget rather than fix that here.
Comment #7
borisson_Looks great
Comment #8
borisson_Patch doesn't apply anymore.
Comment #9
joachim CreditAttribution: joachim at Torchbox commentedHere's the patch from my rebased feature branch.
Comment #10
borisson_Committed and pushed, thanks!