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

Command icon 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

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review
timwood’s picture

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

timwood’s picture

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

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

I 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 DeprecationHelper https://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?

ramil g made their first commit to this issue’s fork.

ramil g’s picture

Status: Reviewed & tested by the community » Needs review

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

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

I was too quick, my testing showed those empty list values too. Good catch @ramil g getting the &$variables passed 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.

mradcliffe made their first commit to this issue’s fork.

borisson_’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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