The ordering of content type is broken

Created on 25 July 2023, 11 months ago
Updated 27 April 2024, about 2 months ago

Problem/Motivation

If the number of "content type" exceeds the setting of "Maximum number of bundle sub-menus to display", it will cause problems in the order of "content type" displayed on the menu bar
reason: added sort('weight') on config without weight attribute

Steps to reproduce

1. Go to admin/config/user-interface/admin-toolbar-tools
1.go to admin/config/user-interface/admin-toolbar-tools and set the "Maximum number of bundle sub-menus to display" value to 4
2. Add 6 content types, named as a, b, c, d, e, f
3. Look at the "content type" under "structure", and you will find that the displayed content type is not a, b. It is sorted and displayed according to uuid

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇨🇳China randy Tang

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

Merge Requests

Comments & Activities

  • Issue created by @randy Tang
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    16 pass, 1 fail
  • 🇮🇳India swatidhurandhar

    I was only able to reproduce this issue in Drupal9.5.10, in Drupal10 it is not reproducible. I tested the above patch in D9.5.10, it works fine. I have attached screenshots of admin toolbar sequence both before and after application of patch.

  • Status changed to RTBC 11 months ago
  • Status changed to Needs review 11 months ago
  • Status changed to Needs work 6 months ago
  • 🇮🇳India Kanchan Bhogade

    Hi,
    Tested #2 patch on Drupal version 9.5.11 and 10.0
    The patch was applied successfully on both version

    Testing Steps:
    Set up the Drupal and theme
    Add Admin toolbar
    Go to admin/config/user-interface/admin-toolbar-tools and set the "Maximum number of bundle sub-menus to display" value to 4
    Add 6 content types, named as a, b, c, d, e, f
    Look at the "content-type" under "structure", and you will find that the displayed content type is not sorted
    Apply the shared patch & reverify the results.

    Test Result:
    For D 9.5- The patch was applied successfully, and the ordering of content type broken issue is Fixed
    For D 10- The patch was applied successfully, but the issue not fixed.

    Screenshots are attached for reference
    Moving to Needs Work

  • I was able to replicate the issue in both Drupal 10.1.6 and Drupal 9.5.0, but I couldn't successfully apply the provided patch in either of them.

  • First commit to issue fork.
  • Merge request !69Resolve #3376753 "The ordering of" → (Open) created by marcoliver
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 5 months ago
    Waiting for branch to pass
  • Status changed to RTBC 5 months ago
  • 🇩🇪Germany marcoliver Neuss, NRW, Germany

    Patch worked fine for me as well. Created an issue fork. Marking as RTBC.

  • First commit to issue fork.
  • Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 8
    last update 3 months ago
    Waiting for branch to pass
  • Status changed to Needs review 3 months ago
  • 🇦🇺Australia acbramley

    Pushed some changes to the MR:

    - We need accessCheck(FALSE) since these are built during cache rebuild, access is checked when menu items are rendered
    - We don't need to check if weight exists, it'll silently do nothing if it doesn't
    - We can improve this further by sorting by label after weight. This helps when for example all vocabularies have the same weight - they'll be queried alphabetically.

  • 🇮🇳India divya.sejekan

    Tested in Drupal 10.2 . Still the ordering is not right. Attached the image
    Order displayed is Article , basic a , b ...
    Im bit confused here , Should this be alphabetically ordered?

  • Status changed to Needs work about 2 months ago
  • 🇩🇪Germany marcoliver Neuss, NRW, Germany

    Also gave the latest commit another look and I share divya.sejekan's confusion.

    Ideally, shouldn't the entries in the menu be in the same order the entities would be on the entity list page? A.k.a. using the NodeType sort() function?

  • Status changed to Needs review about 2 months ago
  • 🇦🇺Australia acbramley

    Re #14 and #15 this has to be generic to all content entity types, not just node types. Currently the MR sorts by weight, then label. IMO the after patch is closer to what is expected than the before so putting this back into needs review.

    A.k.a. using the NodeType sort() function?

    What is that?

Production build 0.69.0 2024