While I was reviewing a module in PA, I observed this weird behaviour of Default parent item. Refer to comment here: https://www.drupal.org/node/2853529#comment-11946250
After debugging I found that Options in menu_parent item is added on line : http://cgit.drupalcode.org/drupal/tree/core/modules/menu_ui/menu_ui.modu...
$options = $menu_parent_selector->getParentSelectOptions('', NULL, $options_cacheability);
$form['menu']['menu_parent'] = array(
'#type' => 'select',
'#title' => t('Default parent item'),
'#default_value' => $type->getThirdPartySetting('menu_ui', 'parent', 'main:'),
'#options' => $options,
'#description' => t('Choose the menu item to be the default parent for a new link in the content authoring form.'),
'#attributes' => array('class' => array('menu-title-select')),
);
and options are generated on change of input of any of the menu options in menu_ui.admin.js here : http://cgit.drupalcode.org/drupal/tree/core/modules/menu_ui/menu_ui.admi...
Drupal.behaviors.menuUiChangeParentItems = {
attach: function (context, settings) {
var $menu = $('#edit-menu').once('menu-parent');
if ($menu.length) {
// Update the list of available parent menu items to match the initial
// available menus.
Drupal.menuUiUpdateParentList();
// Update list of available parent menu items.
$menu.on('change', 'input', Drupal.menuUiUpdateParentList);
}
}
};
Module in PA is just using hook_node_form_alter() for adding an element, and I am quite sure it doesn't do anything wrong.
Please see attached screenshot.
Comments
Comment #2
ank.g9 commentedCreated a patch for this issue, Please review.
Comment #4
pameeela commentedI'd love to get this issue a review, there was a patch posted from the start but it has never had a review.
Comment #8
smustgrave commentedThis came up as daily triage ticket in the bugsmash channel
This looks like it will need an issue summary update. Mainly
Steps to reproduce
What is the proposed solution. I see the patch but don't fully follow what is being solved.
Also the patch will need to be updated with the es6 file also.
And if this is a bug it will need a test case.
Comment #11
smustgrave commentedSo I believe this one is out of date. There is no longer a "Provide a default" option in D11. Not sure if this was behavior before or a custom module (D7 memory is fuzzy). But order appears to be the same. If I got this wrong please re-open
Thanks all.