Commit 185ac29d authored by webchick's avatar webchick

Issue #2160593 by Wim Leers, vijaycs85: Remove drupal_add_js() from...

Issue #2160593 by Wim Leers, vijaycs85: Remove drupal_add_js() from menu.module/remove inline JavaScript from menu.module.
parent a5211472
......@@ -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);
});
}
};
......
......@@ -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';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment