视图的Drupal MENU_LOCAL_TASK

时间:2011-02-16 00:42:21

标签: drupal drupal-views

想要在标签下分组两个或更多不同的视图(“页面”样式)。无法让它工作,标签没有显示。我想问题是我没有正确定义页面回调。

这就是我的尝试:

function general_menu() {

   $items = array();

   $items['people'] = array( // First view has path named "people"
    'title' => 'People',     
    'access arguments' => TRUE,
    );

    $items['people/list'] = array(
      'title' => 'People',
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );

    $items['people/og'] = array( // Second view has path named "people/og"
      'title' => 'Groups',
      'type' => MENU_LOCAL_TASK,
      'access arguments' => TRUE,
          'page callback' => 'mymodule_link_to_group_create', // <- maybe wrong
    );

return $items;

}

// Not sure I need it
function mymodule_link_to_group_create() {
   drupal_goto('people/og');
}

如何正确定义视图的“页面回调”?

谢谢!

3 个答案:

答案 0 :(得分:2)

...
    $items['people/og'] = array( // Second view has path named "people/og"
      'title' => 'Groups',
      'type' => MENU_LOCAL_TASK,
      'access arguments' => TRUE,
      'page callback' => 'mymodule_link_to_group_create', // <- maybe wrong
    );

...

function mymodule_link_to_group_create() {
  return views_embed_view('YOURVIEWSNAME', 'DISPLAYID'); // displayid usually default
}

答案 1 :(得分:1)

为什么不在页面设置下定义视图中的菜单?

答案 2 :(得分:1)

使用Quicktabs module可能更容易。