Problem/Motivation

The reorder method was broken by requiring the wrong type. The parent id of a MenuLinkContent is a string:
TypeError: MenuHelper::reorder(): Argument #1 ($parentId) must be of type ?int, string given

Reordering menu link items might not work when other elements use default weights.

Steps to reproduce

- Set two links under the same parents to weights -50 and -49.
- Use pagetree to reorder the link with weight -49 above the one with -50. The moved link will get a weight of 20, the other link will keep -50, so the links are not reordered.

Proposed resolution

- Adjust MenuHelper::reorder(): Argument #1 ($parentId) to be "string"

Issue fork pagetree-3383943

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pvbergen created an issue. See original summary.

pvbergen’s picture

Project: Page tree » Frontend publishing

pvbergen’s picture

Status: Active » Needs review

  • pvbergen committed 505f60b6 on 2.x
    Issue #3383943: TypeError: MenuHelper::reorder(): Argument #1 ($parentId...
pvbergen’s picture

Status: Needs review » Fixed
pvbergen’s picture

Title: TypeError: MenuHelper::reorder(): Argument #1 ($parentId) must be of type ?int, string given » Reordering fails due to type error
Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.