Date range facet values don't appear in Facets Summary

Created on 17 May 2022, about 2 years ago
Updated 7 February 2024, 4 months ago

Problem/Motivation

When using the Facets Summary module/block, selected Date Range facets do not appear in the summary.

Steps to reproduce

Add a date range facet, and some other non-date range facets. Expected result, perhaps show the beginning/end range as 2 separate links? Current behavior, they do not appear. The 'clear all' button does successfully unset the values though.

Proposed resolution

Remaining tasks

User interface changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jhedstrom Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 5.7
    last update about 1 year ago
    1 pass
  • First commit to issue fork.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 5.7
    last update 4 months ago
    1 pass
  • πŸ‡ΊπŸ‡ΈUnited States robpowell Boston

    #6 does the following

    When results are empty (they can be with a date range facet), this throws a fatal error. This should be preceded by a check to make sure $results is not empty.

    Rather than get the url parameters from the facet which can return no results, I changed the logic to use the current request. This allows us to show facet summary regardless if there are no results or not.

    I changed the logic on string replace to match the new format.

      $pattern = '/min:\d+/';
                      $replacement = 'min:';
                      $clear_set_min_date = preg_replace($pattern, $replacement, $filter);
    

    Added a label to the facet summary "pills"

     $min_label = $facet_instance->getWidget()['config']['min_label'];
                      $value = Markup::create('<strong>' . $this->t($min_label) . '</strong>: ' . gmdate($this->getConfiguration()['date_format'], $min));
                      $item = [
                        '#theme' => 'facets_result_item__summary',
                        '#value' => $value,
    
Production build 0.69.0 2024