Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filterable method for getting the individual term HTML to the Facet widget. #2363

Merged
merged 9 commits into from
Sep 24, 2021

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented Sep 23, 2021

Description of the Change

Moves the markup for individual facet terms in the Facet widget into its own method, and adds a ep_facet_widget_term_html filter to the output to support filtering the HTML of individual facet terms.

Benefits

Allows filtering the HTML of individual facet terms without needing to filter the entire output of the widget.

Possible Drawbacks

None that I'm aware of, apart from the usual considerations when introducing filters.

Verification Process

  • On a site with ElasticPress installed and content indexed, add the Facet widget and confirm that it continues to function as expected.
  • Use the ep_facet_widget_term_html filter to change the HTML of individual terms and confirm that changes are reflected on the front end.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Addresses #2358.

Changelog Entry

Adds ep_facet_widget_term_html filter to the Facet widget for filtering the HTML of individual facet terms.

@JakePT JakePT requested a review from felipeelia September 23, 2021 07:28
@JakePT JakePT changed the title Add filterable method for getting the individual term HTML Add filterable method for getting the individual term HTML to the Facet widget. Sep 23, 2021
@JakePT JakePT linked an issue Sep 23, 2021 that may be closed by this pull request
@felipeelia felipeelia added this to the 3.6.3 milestone Sep 23, 2021
*/
$label = apply_filters( 'ep_facet_widget_term_label', $term->name, $term, $selected );

$link = sprintf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if it's worth adding a filter to $link... 🤔

@felipeelia felipeelia merged commit 28b2720 into develop Sep 24, 2021
@felipeelia felipeelia deleted the feature/facet-filters branch September 24, 2021 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facets: Create new filters
3 participants