用于视图的 Drupal MENU_LOCAL_TASK

发布于 2024-10-17 10:41:39 字数 874 浏览 2 评论 0原文

想要在选项卡下对两个或更多不同的视图(“页面”样式)进行分组。无法使其工作,选项卡未显示。我想问题是我没有正确定义页面回调。

这就是我尝试过的:

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');
}

How toproperlydefine“pagecallback”forviews?

谢谢!

Want to group two and more different views ("page" style) under tabs. Can't get it working, tabs didn't show. I guess the problem is that I didn't define page callback properly.

This is what I tried:

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');
}

How to properly define "page callback" for views?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜心小果奶 2024-10-24 10:41:39
...
    $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
}
...
    $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
}
森罗 2024-10-24 10:41:39

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

Why not just define the menu's in the view under Page Settings?

波浪屿的海角声 2024-10-24 10:41:39

使用Quicktabs 模块可能会更容易。

It might be easier to use the Quicktabs module.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文