How to set target page URL for links in widget of Facet Block?

Created on 29 May 2019, about 5 years ago
Updated 9 April 2024, 3 months ago

I have Views with Facets, that placed on page as block via Layouts Builder. And I place block, contains Facet with "List of links" widget, displayed on all site pages, not only in my views page - with unchecked "Hide facet when facet source is not rendered" I can normally display this block on any page.

But the problem is that widget links of this block targets to current page url, instead of my views page url. So, if I visit/about url, facet block contains links like /about?f[0]=param:value (on /about page) instead of /my-views-page?f[0]=param:value.

In Drupal 7.x, regarding to https://www.drupal.org/docs/7/modules/search-api/advanced-site-building-... β†’ , I can add "Facets block" Views display, where can I set "Search page path", but this feature is missing in Drupal 8.x branch.

So, how can I set needed URL for widget items links in Facets block?

πŸ’¬ Support request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡²Armenia Murz Yerevan, Armenia

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

Comments & Activities

Not all content is available!

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

  • πŸ‡³πŸ‡ΏNew Zealand jonathan_hunt

    Patch #25 applies to 3.0.0-beta1 and works. However, I have another facet (a) on the same page as facet (b) with base path. facet (a) does not have base path set, and if facet (a) is submitted first, the base path on facet (b) is ignored when the facets are re-rendered.

  • πŸ‡¨πŸ‡­Switzerland Mistrae

    Had to switch isRenderedInCurrentRequest after getBasePath or it was always trigerred by isRenderedInCurrentRequest.

  • πŸ‡¨πŸ‡­Switzerland DamienMo

    Adde missing "use Drupal\Core\Path\PathValidatorInterface;" in FacetForm.php Causing an error on facet edition page.

    The error was:

    TypeError: Drupal\facets\Form\FacetForm::__construct(): Argument #6 ($pathValidator) must be of type Drupal\facets\Form\PathValidatorInterface, Drupal\Core\Path\PathValidator given

Production build 0.69.0 2024