summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/book/book.module3
-rw-r--r--modules/menu/menu.admin.inc1
-rw-r--r--modules/menu/menu.module9
3 files changed, 12 insertions, 1 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index 4dace3bcb..f0fe5154a 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -328,6 +328,9 @@ function book_form_alter(&$form, $form_state, $form_id) {
* form element.
*/
function _book_parent_select($book_link) {
+ if (variable_get('menu_override_parent_selector', FALSE)) {
+ return array();
+ }
// Offer a message or a drop-down to choose a different parent page.
$form = array(
'#type' => 'hidden',
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'),