Hierarchy and menu item order lost when creating menu link item children that have a lower entity ID than parent

Created on 20 July 2022, over 2 years ago
Updated 3 July 2023, over 1 year ago

Problem/Motivation

The menu items to be cloned is loaded with a `loadByProperties` method which returns the items in the same order as the `menu_link_content` entity ID. During the clone process, the duplicated menu items may attempt to set a parent item that does not exist yet.

Steps to reproduce

1. Create several menu items for a menu to be cloned.
2. Manipulate the weights and hierarchy so that some menu items that were created later, are parents for earlier menu items.
3. Run the clone process

Proposed resolution

Load the menu tree and process menu items in the same order as the hierarchy.

Remaining tasks

Test and potentially implement supplied patch

πŸ› Bug report
Status

Needs review

Version

3.2

Component

Code

Created by

πŸ‡ΏπŸ‡¦South Africa uberellis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¬πŸ‡§United Kingdom Michelle-Buckby

    Also seeing the error mentioned:
    ```
    TypeError: Argument 1 passed to Drupal\menu_link_clone\Form\EntityMenuLinkCloneForm::addSubtreeItemsToArray()
    ```
    when applying Patch #2

    Patch #3 not applying:
    Drupal core 9.5
    Menu Link Clone: ^3.2

Production build 0.71.5 2024