Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using Facetapi Pretty Paths to rewrite ?f[0], the Facet Blocks don't work with Facetapi Pretty Paths.
Comment | File | Size | Author |
---|---|---|---|
#10 | 1818572-10--facets_block_pretty_paths.patch | 1.69 KB | drunken monkey |
|
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedAttached a patch that rewrites the path. It's working for me, let me know what you think of it.
Comment #2
guillaumev CreditAttribution: guillaumev commentedNew patch that works for me (maybe after a few more releases of search_api).
Comment #3
cossimo CreditAttribution: cossimo commentedI know this is an old thread, but neither of the patches worked for me. 1818572-2 is close but makes the link relative to the page on which the facets block resides, instead relative to the search page it's supposed to reference. Since all my facets blocks are on node-based pages and have a consistent url pattern, it was easy enough to alter $variables['path'] to make it work.
However, while I'm including my solution below for reference, it is ugly, brittle, short-sited and not fit for general consumption. I'm hoping there's someone out there smarter than I am, who might come up with a better solution.
C.
Comment #4
Sakhmed CreditAttribution: Sakhmed commentedFinally :-) #3 worked for me!
Thank you a lot!
Comment #5
drunken monkeyHm, interesting. Thanks for the input!
Maybe try to ask in the Facet API Pretty Paths issue queue for help regarding how to change the base path used? That seems to be the only missing thing here. Otherwise, you could at least determine from
current_path()
how many leading path segments tounset()
from the path created by the URL processor.Comment #6
dasjomaybe #2413319: Add base path provider plugins helps
Comment #7
a.dmitriiev CreditAttribution: a.dmitriiev as a volunteer commentedIn addition to patch #2 it would be nice to have alias for taxonomy term:
Comment #8
lodey CreditAttribution: lodey at NDP commented#2 works well, but we can then also get to the current base path value using the getBasePath() method and then remove it from the pretty path generated by getFacetPath() method using a str_replace.
This patch works well for me.
Comment #9
lodey CreditAttribution: lodey at NDP commentedComment #10
drunken monkeyThanks, looks good. Attached are just a few style improvements/nit-picks.
However, it would be good to get confirmation from some other people that this indeed works as intended and doesn't break anything. I don't completely understand the code and want to make sure that it works as intended for all use cases we currently support.
Comment #11
popstas CreditAttribution: popstas commentedPatch #10 works for me, search_api 7.x-1.19
Comment #13
drunken monkeyGood to hear, thanks for testing and reporting back!
Committed.
Comment #14
cossimo CreditAttribution: cossimo commentedThe patch in #10 worked perfectly for me.
Thanks, and FYI,
C.