As part of #3589162: Support special hierarchy processors as exposed filters, the (entirely unrelated) change was made to replace the deprecated template_preprocess_item_list() call in facets_preprocess_facets_item_list() with \Drupal::service(ThemePreprocess::class)->preprocessItemList().
However, as that service isn’t available for module versions earlier than Drupal 11.3, this leads to a fatal error for all older versions.
This is trivial to fix using the DeprecationHelper. Alternatively, of course, the 3.x version could declare a minimum Core version of 11.3.
Similar to #3594309: Broken/missing handler after update to Facets 3.0.4: Restore facets_exposed_filters.module file and use LegacyHook for Drupal 10, but affecting even some Drupal 11 versions.
Issue fork facets-3605291
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
drunken monkeyComment #4
timwoodSeems like the same issue reported in https://www.drupal.org/project/facets/issues/3618076. Not sure which to keep. The other issue's MR has added test coverage.
Comment #5
timwoodWhen I apply the MR diff (https://git.drupalcode.org/project/facets/-/merge_requests/387.diff) to my 10.6.15 Drupal core site, my facets now render empty with no options.
Comment #6
joelpittetI reviewed the two approaches and going to vote that this is the right way to do the BC changes (the other has a test, but gitlab complains a bit about the deprecated call) with the
DeprecationHelperhttps://www.drupal.org/node/3379306.@timwood maybe you need #3594309: Broken/missing handler after update to Facets 3.0.4: Restore facets_exposed_filters.module file and use LegacyHook for Drupal 10 for the handler?
Comment #8
ramil g commentedI found that the callbacks were capturing $variables by value, so the preprocessing changes were being lost and the facets rendered as empty list items. I updated the callbacks to capture it by reference and added a kernel test. I also tested it on Drupal 10, and the facet links are rendering again.
Comment #9
joelpittetI was too quick, my testing showed those empty list values too. Good catch @ramil g getting the
&$variablespassed in. I needed to double check the use (I don't use anonymous functions enough to realize that is correct).I would credit @asamoahboateng for the test as it looks like the same test proposed in #3618076: Fatal error ServiceNotFoundException: ... "Drupal\Core\Theme\ThemePreprocess" on Drupal 10 in facets 3.0.4
https://git.drupalcode.org/project/facets/-/merge_requests/396/diffs#02d... which I closed recently in favour of this.
Comment #12
borisson_