getChildIds() method of MenuLinkManager should return menu-items sorted by weight

Created on 22 June 2018, about 6 years ago
Updated 4 February 2023, over 1 year ago

Problem/Motivation

getChildIds() method of MenuLinkManager should return menu items sorted by weight
This method internally calls return $this->treeStorage->getAllChildIds($id); of MenuTreeStorage service class.

Since menu-items are draggable - My hope is to get them in sorted order as I see in the UI.

Proposed solution

  1. We add the orderby - weight clause to the query so that the menu-items returned are in sync with what we see UI and not with how they were added and are stored in the database
  2. Second - If we do not want to add weight as the default option for returning menu items, We could add a second argument to the method which if passed TRUE - returns items sorted by weight else items are returned as they are stored in the database
  3. Second argument could have been user based parameter(configurable) as to what we want sorting based on- But I am not sure of any other sorting options other than weight for menu-items

User interface changes
None

API changes
yes - Based on the approach that we decide.

Data model changes
Nope.

Feature request
Status

Needs work

Version

10.1

Component
Menu system 

Last updated 1 day ago

Created by

🇮🇳India neetu morwani

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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 States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Think with this new feature it will need test coverage so it never breaks in the future.

Production build 0.71.5 2024