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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

borisson_’s picture

That's a solid idea.

joachim’s picture

Assigned: Unassigned » joachim

Patch coming.

joachim’s picture

Here'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.

borisson_’s picture

Status: Needs review » Needs work

I'm not sure if it's needed inside the buildListItems, for consistency I'd say we should.

joachim’s picture

Updated 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.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks great

borisson_’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Patch doesn't apply anymore.

joachim’s picture

Here's the patch from my rebased feature branch.

borisson_’s picture

Status: Needs review » Fixed

Committed and pushed, thanks!

  • borisson_ committed 9064a63 on 8.x-1.x authored by joachim
    Issue #2896202 by joachim: add template suggestions for facets-item-list...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.