Problem/Motivation

Slider facets do not display the title of the facet.

Proposed resolution

Long-term: having these widgets implement templates (similar to list facets) is desirable. Quick solution: add a render element to the widget that (optionally) displays and wraps the title in h3 tags.

CommentFileSizeAuthor
#6 3002580_6.patch1023 bytesmpp
#2 slider_facet_titles-3002580-2.patch802 bytesJacobSanford
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JacobSanford created an issue. See original summary.

JacobSanford’s picture

Quick patch for those needing a fix

JacobSanford’s picture

Issue summary: View changes
Nick Hope’s picture

The patch in #2 works for me. Thanks a lot!

mpp’s picture

Adding a render element seems like a quick workaround.

SliderWidget::build should probably return the same theme render array as WidgetPluginBase::build, namely

    return [
      '#theme' => $this->getFacetItemListThemeHook($facet),
      '#facet' => $facet,
      '#items' => $items,
      '#attributes' => [
        'data-drupal-facet-id' => $facet->id(),
        'data-drupal-facet-alias' => $facet->getUrlAlias(),
      ],
      '#context' => ['list_style' => $widget['type']],
      '#cache' => [
        'contexts' => [
          'url.path',
          'url.query_args',
        ],
      ],
    ];
  }

So SliderWidget::build should first call it's parent build.

  public function build(FacetInterface $facet) {
    $build = parent::build($facet);

mpp’s picture

Status: Active » Needs review
FileSize
1023 bytes

This is a different approach where I call the parent::build() so that I'm sure the output uses the same theming.

borisson_’s picture

I really like the approach in #6. If we can get that one veryfied by someone else I'd be happy to take that in.

Nick Hope’s picture

The patch in #6 works for me. I patched 8.x-1.1 and tested with a range slider widget in D8.6.2. Thanks very much mpp.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, setting this to rtbc.

  • borisson_ committed 8734517 on 8.x-1.x authored by mpp
    Issue #3002580 by JacobSanford, mpp: Slider facets do not display titles
    
borisson_’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for that validation @Nick Hope! Committed and pushed the patch

Status: Fixed » Closed (fixed)

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