diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-21 19:08:18 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-11-21 19:08:18 +0000 |
commit | 7f85abe0e5e7d3d824dadaa08305d04e64343837 (patch) | |
tree | 1fd21ca36a34708466d52736ec58c7cc2103e2a5 /modules/menu | |
parent | 8e73e4600bc859972a73c6cabc586706bc0ac62d (diff) | |
download | brdo-7f85abe0e5e7d3d824dadaa08305d04e64343837.tar.gz brdo-7f85abe0e5e7d3d824dadaa08305d04e64343837.tar.bz2 |
#191360 by chx: allow contributed modules to override the book and menu parent selectors (to improve usability and performance)
Diffstat (limited to 'modules/menu')
-rw-r--r-- | modules/menu/menu.admin.inc | 1 | ||||
-rw-r--r-- | modules/menu/menu.module | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 8d335fc0b..37b56041b 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -229,6 +229,7 @@ function menu_edit_item(&$form_state, $type, $item, $menu) { '#tree' => TRUE, '#weight' => -2, '#attributes' => array('class' => 'menu-item-form'), + '#item' => $item, ); if ($type == 'add' || empty($item)) { // This is an add form, initialize the menu link. diff --git a/modules/menu/menu.module b/modules/menu/menu.module index d5291cf02..884b4faed 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -202,7 +202,13 @@ function menu_load($menu_name) { * and mlid. The list excludes the given item and its children. */ function menu_parent_options($menus, $item) { - + // The menu_links table can be practically any size and we need a way to + // allow contrib modules to provide more scalable pattern choosers. + // hook_form_alter is too late in itself because all the possible parents are + // retrieved here, unless menu_override_parent_selector is set to TRUE. + if (variable_get('menu_override_parent_selector', FALSE)) { + return array(); + } // If the item has children, there is an added limit to the depth of valid parents. if (isset($item['parent_depth_limit'])) { $limit = $item['parent_depth_limit']; @@ -378,6 +384,7 @@ function menu_form_alter(&$form, $form_state, $form_id) { foreach (array('mlid', 'module', 'hidden', 'has_children', 'customized', 'options', 'expanded', 'hidden', 'parent_depth_limit') as $key) { $form['menu'][$key] = array('#type' => 'value', '#value' => $item[$key]); } + $form['menu']['#item'] = $item; $form['menu']['link_title'] = array('#type' => 'textfield', '#title' => t('Menu link title'), |