1

I've got a view page that serves like a catalog, using many exposed filters.

I want a menu link that points to a certain combination of filters. Let's say the URL for this filtered view is>

view?option[]=7&option[]=12&option[]=14

Sounds simple, but I'm finding this difficult for a number of reasons:

  • Menu considers this an invalid path
  • I can't turn it into a path alias, because that also considers it an invalid path
  • I can set it up as a redirect, but Menu still won't recognise the redirect as a valid path
  • I can set it up as a Page Manager page using cTools' page manager, and set that to act as a redirect, but every parameter except the last one gets chopped and it redirects to this. It seems like it doesn't like the ampersands:

view?option[]=14

  • If I input it with the ampersands URL encoded, it gets confused because it double URL encodes the URL encoded characters, breaking them.
1

Got it working. I set it up as a Page Manager page with an arbitrary path (e.g. options or view/options), set to "HTTP Response Code" then "301 redirect".

The problem in the question where the ampersand-seperated characters were getting eaten seemed to be caused by Drupal treating them as duplicates of each other and rejecting all except the last. To get around that, I set the redirect URL to:

view?option[1]=7&option[2]=12&option[3]=14

Note how each one has a unique number in the square brackets.

Views doesn't seem to care about the numbers in the square brackets, and they stop Drupal merging the parameters into one.


Note you should always input the non-encoded version, like above, else Drupal will double-encode it causing it to break. Keep this in mind if you edit it - you'll need to replace the whole string with the original, non-encoded version then edit that before saving.

  • 1
    I was able to use your solution of adding unique ids inside the square brackets to add multiple exposed filters to a url in the menu directly - eg view?option[1]=7&option[2]=12&option[3]=14 – calebtr Aug 23 '16 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.