Closed (fixed)
Project:
Facets
Version:
2.0.7
Component:
Facet summary
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Nov 2021 at 16:29 UTC
Updated:
24 Jul 2024 at 11:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
marcvangendI see the same. The cause of the problem seems to be that \Drupal\facets_summary\FacetsSummaryManager\DefaultFacetsSummaryManager::build has the correct order available in
$facets_config, but instead of looping over that, it iterates over the unordered$facetsto build the output. This could be solved by ordering$facetsby the keys of$facets_configlike this:But I think that's not all. While this seems to work correctly for the "reset_facets" summary processor, I noticed that \Drupal\facets_summary\Plugin\facets_summary\processor\ShowSummaryProcessor::build uses array_unshift to add the items to an array. So that suggests that the order would still be reversed. I hope this helps someone get started with a proper issue fork or patch.
Also, needs tests.
Comment #4
nmillin commentedI followed what @marcvangend did, and it worked for me. I created the fork/MR to get something started. There will need to be tests (like what marcvangend mentioned).
Hopefully this will help others review this. Thanks.
Comment #7
gnugetI added the tests and adjusted a bit the method used to order the facet summary (instead of relying on the configuration, the `#weight` is checked).
The same tests that fail on the dev version of the module are failing here so the new tests are passing 🥳
This is ready to be reviewed.
Thanks, @Grimreaper and @nmillin for the initial work.
(I created two more branches by accident lol, I'm still learning how to use gitlab instead of relying on patches, apologies for that 😅)
Comment #8
gnugetI just realized that relying on the patch generated by the merge request might not be best idea given that if it is updated the Merge Request the patch will be updated, so here a static version of the patch.
Comment #9
andreasderijckePatch from #8 still works on 2.0.7 and fixes the issue for us.
Comment #12
borisson_Looks great, thanks all.