diff --git a/core/modules/menu/menu.admin.js b/core/modules/menu/menu.admin.js index 6f33ccfb75c5572aec6a849d4f207f029717f933..85129713d8e3d05480ede55be9c11514003d21e8 100644 --- a/core/modules/menu/menu.admin.js +++ b/core/modules/menu/menu.admin.js @@ -4,8 +4,15 @@ Drupal.behaviors.menuChangeParentItems = { attach: function (context, settings) { - // Update list of available parent menu items. - $('#edit-menu').on('change', 'input', Drupal.menuUpdateParentList); + var $menu = $('#edit-menu'); + $menu.once('menu-parent', function () { + // Update the list of available parent menu items to match the initial + // available menus. + Drupal.menuUpdateParentList(); + + // Update list of available parent menu items. + $menu.on('change', 'input', Drupal.menuUpdateParentList); + }); } }; diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 0e5ea66c3f8d93209597510c3e580436ccb09546..774526a5220cec8739353f061d424784e6ad9160 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -633,13 +633,6 @@ function menu_form_node_type_form_alter(&$form, $form_state) { '#attributes' => array('class' => array('menu-title-select')), ); - // Call Drupal.menuUpdateParentList() to filter the list of - // available default parent menu items based on the selected menus. - drupal_add_js( - '(function ($) { Drupal.menuUpdateParentList(); })(jQuery);', - array('scope' => 'footer', 'type' => 'inline') - ); - $form['actions']['submit']['#submit'][] = 'menu_form_node_type_form_submit'; }