The "Filter by tags:" block in the attached screenshot is still rendered when it's empty, i.e. when there are no tags available in search results.

Is there a way to hide these empty blocks? or at least have some kind of no-results behaviour, something like t('No filters available').

CommentFileSizeAuthor
#4 facetapi-1153980-4.patch640 bytescpliakas
Screenshot-2.png37.89 KBpjcdawkins

Comments

cpliakas’s picture

Category: support » bug

Hi pjcdawkin.

Thanks for the post. I actually saw this last night but forgot to add an issue. I really like your idea about having a "empty result" setting similar to Views. I think this is both a bug report and feature request, so I am marking as a bug report since that is more likely catch my attention and prevent it from slipping through the cracks.

Thank,
Chris

cpliakas’s picture

Title: Auto-hide blocks (possible feature request) » Blocks are not hidden when there are no items are available for a facet

Changing title to reflect the bug portion of this issue.

cpliakas’s picture

Title: Blocks are not hidden when there are no items are available for a facet » Blocks are not hidden when no items are available for a facet

Fixed awful grammar.

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new640 bytes

The attached patch fixes the bug portion of this issue.

cpliakas’s picture

Status: Needs review » Fixed

Committed at ad7c0ea. Opened separate issue at #1154794: Implement setting to configure the behavior when a facet has no items for the feature request.

patrick r.’s picture

I think it would be only logical to go one step further and hide all facet links which will not narrow down the result set. Basic example: if you do a search that returns a single result row you will get one link in each available facet block which actually won't do anything.

cpliakas’s picture

Patrick R,

Thanks for the post. This is a separate issue outside of the original topic of this thread, so I am starting an issue at #1156606: Implement a configurable filter system that can alter the facet's render array prior to being passing to the widget for further discussion.

Thanks,
Chris

Status: Fixed » Closed (fixed)

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