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

navneet0693 created an issue. See original summary.

ank.g9’s picture

Status: Active » Needs review
StatusFileSize
new523 bytes

Created a patch for this issue, Please review.

Version: 8.2.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Issue tags: +DrupalGov 2020

I'd love to get this issue a review, there was a patch posted from the start but it has never had a review.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Bug Smash Initiative, +Needs issue summary update, +Needs tests

This 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.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Closed (outdated)

So 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.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.