Problem/Motivation
\Drupal\facets\Plugin\facets\url_processor\QueryString::buildUrls()
overwrites the route parameters for the facet URL based on the initial request. However, this overwrites the correct route parameters returned in \Drupal\facets\Plugin\facets\url_processor\QueryString::getUrlForRequest() earlier.
Steps to reproduce
- Create a Search page with a facet on Node type
- Place a facets block on a node page
- Observe the facet URL contains the route parameters for the current node, rather than the Search page.
Proposed resolution
Do not overwrite the route parameters with the route parameters for the current request.
Remaining tasks
- Write a patch
- Review
- Commit
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3165817-2.patch | 1.6 KB | idebr |
Comments
Comment #2
idebr CreditAttribution: idebr at iO commentedAttached patch removes the overwrite of the route parameters with the route parameters for the current request.
Comment #3
borisson_We originally did this for performance reasons, this change does not make it slower again?
Comment #4
idebr CreditAttribution: idebr at iO commented#3013991: QueryString::buildUrls should not rebuild requests for the same facet source path refactored the existing code, so the route parameters are built once per request instead of once per facet result.
This issue removes the route parameters logic entirely.
Comment #6
borisson_Ok, few things in life make me as happy as deleting code. Thanks @idebr!
Comment #7
borisson_Oh, this one should've been set to fixed already.
Comment #9
Sylvio69 CreditAttribution: Sylvio69 commentedHi !
Since the last facet 8.x-1.6 release I have a problem with the facet.
My drupal core version is the last of branch 8, I try on a 8.9.7 and 8.9.8.
- I have a search page (with search_api_pages) with several facets on Node type.
- I place a facets block on a "search" page.
- When a submit my query, the search page works perfectly. I have in a URL the search term :
http://mydruapl.com/fr/recherche/{searchTerm}
- When I click on a facet link/checkbox/whatever, the problem occurs and on the URL I lost the {searchTerm}
http://mydruapl.com/fr/recherche?f[0]={facetName}:{facetValue}
With the 8.x-1.5 => no problem.
I have read the 8.x-1.6 changelog and I found this issue #3165817 with this patch on the comment #2
With the 8.x-1.6 and the reverse patch => It works !
What can I do to manage this behavior ?
Thank you in advance for your answer.
Comment #10
neclimdulI thought I might need to revert this as well but on closer inspection it seems that this is a legitimate fix and the code was only accidentally fixing some problems. @Sylvio69 #3191091: QueryString url_processor broken(ish) for Ajax Views fixed my problem and it might fix yours as well. I'm guessing there is a similar problem with the request stack and i18n that is breaking your site.
Comment #11
Neslee Canil Pinto@here i am also having similar issue as of #9
Comment #12
ankithashettyAgree with #9, been facing a similar issue!