Drupal $tabs 不包括编辑/修订/工作流程

发布于 2024-08-08 13:44:40 字数 325 浏览 4 评论 0原文

我继承了 Drupal5 站点并负责进行一些更改,但我不知道从哪里开始寻找。

在许多页面上都有一个可供管理员使用的菜单,允许您执行某些操作:

概述 专家 资源和工具 在现场 消息 活动 课程 多媒体 编辑 追踪 工作流程 设置

但是,在某些部分,有不同的选项: 预览 布局 设置 布局设置 先进的 语境 内容 导出

我需要将(编辑、跟踪、工作流程、设置)添加到第二个菜单,但我不知道该怎么做。

我在 page.tpl.php 中看到 $tabs 区域,但我不知道它是如何构建的。

据我所知,该主题基于 Zen STARTERKIT 主题。

I inherited a Drupal5 site and have been tasked with making some changes, but I'm unable to figure out where to start looking.

On many pages there is a menu available to administrators that allows you do do certain actions:

Overview
Specialists
Resources and Tools
In the Field
News
Events
Courses
Multimedia
Edit
Track
Workflow
Settings

However, on some sections, there are different options:
Preview
Layout
Settings
Layout settings
Advanced
Context
Content
Export

I need to add (Edit, Track, Workflow, Settings) to the second menu, but I'm not sure how to do that.

I see in page.tpl.php there is region for $tabs, but I can't figure out how this gets built.

From what I can tell, the theme is based on the Zen STARTERKIT theme.

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

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

发布评论

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

评论(2

我爱人 2024-08-15 13:44:40

$tabs 变量通常由 MENU_LOCAL_TASK 类型的菜单条目填充。

查看菜单系统,尤其是hook_menu() 以获得基本概念。它归结为回调函数到路径的映射。如果 URL 与 hook_menu 中定义的路径匹配(可以包含占位符!),则将调用为该路径注册的回调函数来生成该 URL 的内容。

hook_menu 项的“type”定义了路径/回调组合在系统中的表示方式。它可以是一个MENU_CALLBACK,这意味着只是注册的路径/回调组合,但没有相应的“真实”菜单条目。 MENU_NORMAL_ITEM 是相同的,但具有“标准”菜单条目,例如在导航菜单中。 MENU_LOCAL_TASK 是相同的,但相应的菜单项通常显示在 $tabs 中而不是菜单中。

所有共享相同基本路径的MENU_LOCAL_TASK最终都会成为一组选项卡。因此,如果您有如下路径:

  • some/path/tab1
  • some/path/tab2
  • some/path/tab3

并且所有这些路径都定义为 MENU_LOCAL_TASK ,您将在每一页上看到每个路径都有一个选项卡他们代表。

因此,要找到需要修改/增强的位置,您应该在代码库中搜索定义这些选项卡显示路径的所有 hook_menu() 实现。请注意,它们不必全部定义在同一位置,但可以来自不同模块中的不同 hook_menu 实现。您需要为要添加的选项卡添加菜单定义,将相关路径映射到回调函数。回调函数将返回用户单击选项卡时应看到的页面内容。

The $tabs variable normally gets populated with menu entries of type MENU_LOCAL_TASK.

Take a look at the menu system, and especially at hook_menu() to get a basic idea. It boils down to a mapping of callback functions to paths. If an URL matches a path defined in hook_menu (can contain placeholders!), the callback function registered for that path will be called to generate the content for that URL.

The 'type' of the hook_menu item defines how the path/callback combination is represented in the system. It can be a MENU_CALLBACK, which would mean just the registered path/callback combination, but no corresponding 'real' menu entry. A MENU_NORMAL_ITEM, would be the same, but with a 'standard' menu entry, e.g. in the navigation menu. A MENU_LOCAL_TASK is the same, but the corresponding menu entry usually shows up in the $tabs and not in a menu.

All MENU_LOCAL_TASK that share the same base path will end up as a group of tabs. So if you had paths like:

  • some/path/tab1
  • some/path/tab2
  • some/path/tab3

and all of these where defined as MENU_LOCAL_TASK, you would see one tab for each of them on each page they represent.

So to find the places you need to modify/enhance, you should search your codebase for all hook_menu() implementations that define the paths where those tabs show up. Note that they need not all be defined at the same place, but could come from different hook_menu implementations in different modules. Than you'd need to add menu definitions for the tabs you want to add, mapping the relevant paths to callback functions. The callback functions would return the content of the pages that the user should see when clicking the tabs.

遇到 2024-08-15 13:44:40

如果您正在显示节点,通常 $tabs 中已经存在“编辑”链接,因为它不存在,可能是其他东西(某种布局模块)。您需要添加编辑/跟踪选项来编辑/跟踪什么样的内容?具体节点还是什么?

If you are displaying node, usually there is already the Edit link in the $tabs, since its not present that might be something else (some kind of layout module). You need to add Edit/ Track options to edit/track what kind of content? Specific node or what?

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