Closed (fixed)
Project:
Select 2
Version:
8.x-1.12
Component:
Facets integration
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2020 at 19:19 UTC
Updated:
21 May 2024 at 11:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
archnode commentedThe provided patch alters the returned array to match the structure of other facet widgets.
Comment #3
johnnydarkko commentedPatch looks good to me, but is it necessary? The problem that I see with this feature is that if it's applied to existing sites is that the change in the display may cause visual regressions. Would be nice if this patch applies default css so that the bullets are removed so that they match the way that standard select field facets are displayed.
Comment #4
weseze commentedPatch is absolutely necessary.
Without it, the facets wrapper never gets rendered and a big bart of the theme logic in facets is skipped. You can for example not use template overrides for facets, not use facet preprocessor implementations, ... because al of that is completely bypassed now.
I, for example, added a lot of custom logic on the facets wrapper twig file and none of that was working on the select2 facet. There was also no way of making it work, since there is no point of entry in the theme layer for select2 facets. It goes from a generic "block" template, straight to generic "form-items" templates...
IMO the possible visual regression should be documented in the release note rather than being "fixed".
Comment #5
idiaz.ronceroI also think this is necessary.
There are many configurations at the facet level (i.e: display the facet title, or display a message if empty results) whose logic is encapsulated on the facet theme (in facets-item-listing, to be more precise).
The fact that Select2 skips this wrapper and outputs directly the Select2 element is basically disabling a bunch of functionality of the original module and makes it harder to develop and maintain.
Comment #6
idiaz.ronceroRegarding johnnydarkko's comment:
The point here (i think) is that the original
facets-item-list.html.twigtemplate is making an assumption that the $items variable will always be populated with an iterable list of elements and therefore builds the most appropriate HTML element: a. This is facet's default behavior and it's ok for lists of links and checkboxes.
In my opinion, this could be improved on the original module since many facets (like select2 or range sliders) will output something very different and making an HTML list for a single element (in our case, the select2 input) feels cumbersome and semantically wrong.
However, there is a simple solution: use theem suggestions and create a
facets-item-list--select2.html.twigwith the following contentComment #9
herved commentedHere's a patch from MR 6, latest commit (db2dffba), in case anyone else needs it.
Our setup enforces static patches and MR diffs are not allowed (as they can change unexpectedly).
Comment #12
chr.fritsch