I'm trying to use Panels to arrange content on my site. I've made some strides in creating a panel that displays a view of images based on different criteria.

I added a page (panel) which allows me to tap into Drupal's menu system and make a tab called Photos. Now I want to add a number of variants to this panel, and I want links to those variants to show up in the sub-tab (MENU_DEFAULT_LOCAL_TASK). Since there does not seem to be any way to add a menu item for each variant, I'm wondering what is the best way to do this.

I see two possibilities, both of which don't seem ideal:

  • I could write a module, that adds the default local tasks to the menu item.
  • I could add a separate panel page for each variant, and use the menus there.

It seems like there should be an easy solution to this. Can anyone help me?


3 Answers 3


I sort of figured out a way to do this.

  1. Add a variant within the Panels module
  2. Add a visibility rule so that different variants show at different URLs (clean URLs and paths required), for example, example.com/paneltitle/variant1, example.com/paneltitle/variant2.
  3. Create a custom module to hook into the menu. There is a great example of a menu module in the module code samples on drupal.org. A example here for above variants:


function custom_module_menu() {
  $items['paneltitle/variant1'] = array(
    'title' => 'variant1',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,

  $items['paneltitle/variant2'] = array(
    'title' => 'variant1',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,

  return $items;

This seems to have worked for me.


You can use the Views module to implement this feature.

Using Views, you can set sub menu task also.


@user379468, could you share your code? I cannot seem to implement the page callback in hook_menu() properly (step 3. in your answer).

  • Never minder, I got it. A page callback isn't necessary.
    – Marcus
    Commented Dec 26, 2012 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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