Drupal 菜单或分类法?

发布于 2024-10-18 22:27:32 字数 188 浏览 4 评论 0原文

我有一个组织的层次结构列表和一个对组织执行操作的模块。我的任务是构建一个页面,其中组织菜单树放置在左侧,模块位于中心。实现这个的最好方法是什么?

我当前的建议是以“organization/$orgid”的形式建立链接,并使模块 hook_menu() 通配符。但问题是我在创建菜单项时无法分配通配符路径。

也许我应该使用分类法?

i have a hierarchical list of organizations and a module that performs actions to an organization. my task is to build a page where a menu tree of organizations is placed on the left side and the module is on center. what is the best way to implement this?

my current suggestion is to make links in the form of "organization/$orgid" and make the module hook_menu() wildcards. but the problem is that i can't assign wildcard paths when creating a menu item.

maybe i should use taxonomy?

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

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

发布评论

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

评论(1

慕烟庭风 2024-10-25 22:27:32

您可以使用组织的分类法并使用以下模块:

  • taxonomy_menu 为分类树自动生成菜单项。
  • menu_block 以不同方式呈现菜单项
  • 视图操作输出

使用 *hook_taxonomy_menu_path* 您可以控制使用 *taxonomy_menu* 模块生成的菜单项使用的路径。

<?php

function mymodule_taxonomy_menu_path() {
  $output = array(
                  'mymodule_path_organizations' => t('Organization'),
                 );

  return $output;
}

function mymodule_path_organizations($vid, $tid) {
  if ($tid == 0) {
    //get all of the terms for the vocab
    $vtids = _taxonomy_menu_get_terms($vid);
    $end = implode(' ', $vtids);
    $path = "taxonomy-orgs/term/$end";
  }
  else {
    $path = 'taxonomy-orgs/term/' . $tid;
  }

  return $path;
}

You could use taxonomy for the organizations and use the following modules:

  • taxonomy_menu to generate menu items automatically for the taxonomy tree.
  • menu_block to render the menu items in different ways
  • views to manipulate the output

Using the *hook_taxonomy_menu_path* you can control what paths the menu items use that get generated using the *taxonomy_menu* module.

<?php

function mymodule_taxonomy_menu_path() {
  $output = array(
                  'mymodule_path_organizations' => t('Organization'),
                 );

  return $output;
}

function mymodule_path_organizations($vid, $tid) {
  if ($tid == 0) {
    //get all of the terms for the vocab
    $vtids = _taxonomy_menu_get_terms($vid);
    $end = implode(' ', $vtids);
    $path = "taxonomy-orgs/term/$end";
  }
  else {
    $path = 'taxonomy-orgs/term/' . $tid;
  }

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