Drupal $选项卡不包括编辑/修订/工作流 [英] Drupal $tabs not including edit / revisions / workflow

查看:106
本文介绍了Drupal $选项卡不包括编辑/修订/工作流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我继承了一个Drupal5站点,并且已经做了一些修改,但是我无法确定哪里可以开始寻找。



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



概述
专家
资源和工具
在领域
新闻
活动
课程
多媒体
编辑
跟踪
工作流
设置



然而,在某些部分有不同的选项:
预览
布局
设置
布局设置
高级
上下文
内容
导出



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



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



从我可以看出,主题是基于禅宗STARTERKIT主题。

解决方案

$ tabs变量通常用$ code> MENU_LOCAL_TASK 的菜单项填充。



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



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



<共享相同基本路径的所有 MENU_LOCAL_TASK 将最终作为一组选项卡。所以如果你有这样的路径:




  • some / path / tab1

  • some / path / tab2

  • some / path / tab3



所有这些定义为 MENU_LOCAL_TASK ,您将在每个页面上看到一个标签。



所以要找到你需要修改的地方/ enhance,你应该搜索你的代码库中所有 hook_menu()实现,定义这些选项卡显示的路径。请注意,它们不需要都在同一个地方进行定义,而是可以来自不同模块中不同的 hook_menu 实现。而不是您需要添加要添加的选项卡的菜单定义,将相关路径映射到回调函数。回调函数将返回用户在单击选项卡时应看到的页面内容。


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.

解决方案

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.

这篇关于Drupal $选项卡不包括编辑/修订/工作流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆