Download & Extend

Remove dependency on $_GET['q'] for determining base paths

Project:Search API
Version:7.x-1.x-dev
Component:Facets
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

relying on $_GET['q'] for determining base paths is quite hacky.

for example in the Facet API Pretty Paths module needs to mock a base path in order to work properly.

we should find other ways to determine base paths

Comments

#1

Status:active» needs review

i have attached a patch that fixes the problem.

see the according facetapi pretty paths issue that depends on this change: #1777714: Don't modify the query path

note, that the patch doesn't remove all usages of $_GET['q'] but just the one that i found causing errors

AttachmentSizeStatusTest resultOperations
1777710_remove_get_q_for_base_paths.patch592 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 269 pass(es).View details

#2

I tested this with a solr backend and it seems to work fine... This plus the associated facetapi_pretty_paths patch is a lifesaver, as the associated problems with views pagers are pretty unpleasant to deal with.

#3

Status:needs review» fixed

Seems to work great, thanks!
Committed.

#4

Status:fixed» closed (fixed)

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

#5

The fix is using menu_get_item() to determine the current page url. This only works if the current page has a menu link. In my case I use page manager to show different search types:

example:
search and search/nodes ... for a search on node index (default)
search/files ... for a search on file index

I set the path in page manager to search/!type, where the type-Argument is optional. The resulting menu_link path is search. On top of this I created two different panel variants using the type argument as criteria to define which search page should be shown (node or file search). The path of menu_get_item() will always be just search, the facets always will link to /search - although the user might be on the search/file page.

My workaround: I created two pages instead of two variants to get it work with menu_get_item().

#6

See #1827272: Facet path can be incorrectly returned for further discussion.
And you shouldn't post into closed issues without re-opening them – this reduces your comment's chances of being seen to practically 0.