summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-11-07 13:35:21 +0000
committerDries Buytaert <dries@buytaert.net>2009-11-07 13:35:21 +0000
commita8ec4e1d505c705ed891212cbf9149c71e4e0a31 (patch)
tree9784ad6ba7f1777614cc5de9221833f3072f9d94 /includes
parent803bd4f968f2d2e16c379cb915bc4fd75088bb6d (diff)
downloadbrdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.gz
brdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.bz2
- Patch #607244 by sun: added permission to decrease performance impact of contextual links.
Diffstat (limited to 'includes')
-rw-r--r--includes/menu.inc25
-rw-r--r--includes/update.inc2
2 files changed, 18 insertions, 9 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 558209355..240615450 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1796,16 +1796,26 @@ function menu_local_tasks($level = 0) {
* If the path "node/123" is passed to this function, then it will return the
* links for 'edit' and 'report-as-spam'.
*
+ * @param $module
+ * The name of the implementing module. This is used to prefix the key for
+ * each contextual link, which is transformed into a CSS class during
+ * rendering by theme_links(). For example, if $module is 'block' and the
+ * retrieved local task path argument is 'edit', then the resulting CSS class
+ * will be 'block-edit'.
* @param $path
- * The menu router path of the object to retrieve local tasks for, for example
- * "node/123" or "admin/structure/menu/manage/[menu_name]".
+ * The static menu router path of the object to retrieve local tasks for, for
+ * example 'node' or 'admin/structure/block/manage'.
+ * @param $args
+ * A list of of dynamic path arguments to append to $path to form the fully-
+ * qualified menu router path, for example array(123) for a certain node or
+ * array('system', 'navigation') for a certain block.
*
* @return
* A list of menu router items that are local tasks for the passed in path.
*
* @see system_preprocess()
*/
-function menu_contextual_links($parent_path, $args) {
+function menu_contextual_links($module, $parent_path, $args) {
static $path_empty = array();
$links = array();
@@ -1851,12 +1861,9 @@ function menu_contextual_links($parent_path, $args) {
if (!$item['access']) {
continue;
}
- // All contextual links are keyed by the actual "task" path argument. The
- // menu system does not allow for two local tasks with the same name, and
- // since the key is also used as CSS class for the link item, which may be
- // styled as icon, it wouldn't make sense to display the same icon for
- // different tasks.
- $links[$key] = $item;
+ // All contextual links are keyed by the actual "task" path argument,
+ // prefixed with the name of the implementing module.
+ $links[$module . '-' . $key] = $item;
}
// Allow modules to alter contextual links.
diff --git a/includes/update.inc b/includes/update.inc
index 84d92917a..96ae71e66 100644
--- a/includes/update.inc
+++ b/includes/update.inc
@@ -140,6 +140,8 @@ function update_fix_d7_requirements() {
'not null' => TRUE,
'default' => 0,
));
+ db_drop_index('menu_router', 'tab_parent');
+ db_add_index('menu_router', 'tab_parent', array(array('tab_parent', 64), 'weight', 'title'));
db_add_field('menu_router', 'theme_callback', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
db_add_field('menu_router', 'theme_arguments', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));