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

CommentFileSizeAuthor
#1 1777710_remove_get_q_for_base_paths.patch592 bytesdasjo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dasjo’s picture

Status: Active » Needs review
FileSize
592 bytes

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

stockliasteroid’s picture

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.

drunken monkey’s picture

Status: Needs review » Fixed

Seems to work great, thanks!
Committed.

Status: Fixed » Closed (fixed)

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

osopolar’s picture

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().

drunken monkey’s picture

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.