Last updated June 23, 2010. Created by jp.stacey on June 23, 2010.
Log in to edit this page.

If you want to put your view page display (with a wildcarded URL), into a hardcoded menu hierarchy, it can't be done with Views alone. Nor can it be done currently with the (otherwise excellent) Menu Trails module. But Panels can help.

Here's an example for where you need e.g. /blog/term/% to appear "under" your /blog menu item. It requires Views Content Panes to be enabled.

In your view

  1. Enable Views content panes module
  2. Move view, or delete page display of your view entirely
  3. Create a "Content pane" display of your view
    • Ensure any arguments your view might have are handled wth a relevant context: has to be specific e.g. taxonomy term ID != taxonomy term IDs (or first ID)
    • Give it a nice administrative title
    • You don't have to check any of the "Allow settings" if you don't need to use this view in several places with different e.g. pager visibility...
    • ... but you might want to permit Panels to override the title: see below
    • Leave it in the "View panes" category if you like
  4. Save your view
  5. Clear all caches (you can do this under Admin > Settings > Site performance, with "drush cache-clear all" or with Admin Menu module's shortcuts.) This might not be done automatically in Panels' own caches, you see.

Then, in Panels

  1. Add a custom page
  2. Set its contexts and URL to be the same as your view requires e.g. /blog/term/!term for an optional taxonomy term, and then set it to accept term IDs.
    • There seems to be no way of modifying contexts after you've set them in the most recent Panels, so be sure your context looks good before you click "continue"
  3. It needs to have a menu item under the menu item you would otherwise want menu trails to set to active.
  4. Set its layout etc.
  5. Add content. If you cleared caches above, you should see the View Panes category.
  6. Select the relevant view pane
    1. Tie it up to any necessary contexts
    2. Override the title and set it to empty; otherwise you might get both the panel page title and the view title appearing

Finally, in core menus:

  1. Move the new menu item to under where you want the trail to point to.
  2. Disable it if you don't want the item itself to show

You should find that when you visit e.g. /blog/term/!term then your menu (and breadcrumbs) show the context of the "blog" page.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.