Hi,

i have included facets summary block in a project with so much front en markup customization and i have found at least a big issue with themer experience. Current implementation of DefaultFacetsSummaryManager use this in build method:

$build = array(
      '#theme' => 'item_list',
      '#attributes' => array(
        'data-drupal-facets-summary-id' => $facets_summary->id(),
      ),
    );

i cannot customize markup of hole summary list to change UL tag or add classes to items. I cannot found a way to change it using preprocess_item_list or theme suggestion. I ended overriding DefaultFacetsSummaryManager service with a custom one to control this theme function. I think that is more flexible to use a custom theme twig file for this list.

Best!
David

CommentFileSizeAuthor
#4 add_template-2846343-4.patch4.09 KBshkiper
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david.gil created an issue. See original summary.

borisson_’s picture

Thanks for reporting this issue. It sounds like a great plan to provide our own twig template.

borisson_’s picture

Looks like this is the same thing as #2796143: Add a wrapping template but for summaries, so the same steps to success:

  1. Add a new entry to the hook_theme implementation. (facet_summaries_item_list)
  2. Add a template that just copies the contents of item_list.html.twig
  3. Test that changing that template changes the output.
shkiper’s picture

Status: Active » Needs review
FileSize
4.09 KB
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I think this is great; looks good! Not sure if we should add a test for this as well; writing a test for this would mean the same thing as writing a test for the theme system.

I'll keep this open for a few days to get opinions on the test in from others but setting it to RTBC in the meantime. @shkiper does this need a drupaldevdays tag?

borisson_’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +drupaldevdays

Committed and pushed, thanks!

  • borisson_ committed c5bde53 on 8.x-1.x authored by shkiper
    Issue #2846343 by shkiper, borisson_: Improve theming experience by...

Status: Fixed » Closed (fixed)

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