Remove weight from menu item definition

Created on 6 November 2024, 15 days ago

Problem/Motivation

The module's menu.yml file includes a weight, which causes the menu item to be placed at the bottom of the menu. In my opinion this should be removed so that Drupal will instead alphabetically sort the menu. This would make it easier to find the menu item in the menu.

Proposed resolution

Remove the weight from the module's menu.yml file.

User interface changes

This change will cause the module's menu item to be sorted alphabetically, rather than placed at or near the bottom of the menu.

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States jsutta United States

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

Comments & Activities

  • Issue created by @jsutta
  • @jsutta opened merge request.
  • 🇮🇳India kulpratap2002

    @jsutta Whenever you work on an issue and fix the errors, please move it to needs review so that it shows up on the issues page.

  • 🇮🇳India zartab farooquee

    To remove the weight from the menu.yml file and enable alphabetical sorting in Drupal:

    Locate the menu.yml file in the module directory.
    Open the file and remove any weight property from the menu items.
    Save the file.
    Clear the cache using drush cr or from the admin interface.
    Verify that the menu items are now sorted alphabetically

    To

    menu_name: main-menu
    parent: main-menu
    title: 'Menu Item'
    weight: 10
    

    This

    menu_name: main-menu
    parent: main-menu
    title: 'Menu Item'
    
Production build 0.71.5 2024