Problem/Motivation
My website had a redesign some time ago. In this redesign, some facet machine names were changed.
My problem is that search engine bots have indexed urls with the old names such as:
/my/page?f[0]=foobar
When no facet with this name is found, I get a 500 response with this error.
Uncaught PHP Exception InvalidArgumentException: "The Facet could not be loaded." at /mnt/www/html/dkrweb/docroot/modules/contrib/facets/src/Utility/FacetsUrlGenerator.php
What I want to achieve is that, if a facet with the non-valid name is supplied on the query string, that this is ignored.
Proposed resolution
The solution I came up with is in the attached patch, which I apply against version 8.x-1.1. It works for me, because I have a RangeSlider on my page, I'm not sure if it will work for everyone.
Comments
Comment #2
michaellenahan commentedHere's the patch, it simply removes invalid items from the
$active_filtersarray in\Drupal\facets_range_widget\Plugin\facets\processor\RangeSliderProcessor::buildComment #3
vdenis commentedComment #5
borisson_Yep, looks very solid and really simple. Committed and pushed, thanks!