Document about menu ordering

Created on 10 April 2025, 8 days ago

Problem/Motivation

Follow up from ๐Ÿ“Œ Fix broken link in MenuTreeStorageInterface Active

Steps to reproduce

NA

Proposed resolution

Add documentation

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component

documentation

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @smustgrave
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arunsahijpal

    Working on it.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arunsahijpal

    The dead link discussed various database strategies for storing hierarchical data, such as:

    • Materialized path (e.g., storing a path like /1/4/7)
    • Nested set model
    • Adjacency list
    • Closure table

    While this was relevant in older versions of Drupal (e.g., 6/7), in modern Drupal (8+), menu trees are abstracted through MenuTreeStorageInterface and implemented by MenuTreeStorage. Internally, a materialized path-like structure is still used (e.g., storing parent, depth, and weight), but this is implementation-specific and subject to change โ€” as the doc comment rightly warns.

    Where should this documentation live?

    I see two good options:

    1- In-code documentation, e.g.:
    A @defgroup menu_tree_storage block in menu.api.php
    Or an @ingroup docblock in MenuTreeStorageInterface or MenuTreeStorage
    This would describe the storage strategies, how ordering is applied, and whatโ€™s considered internal/subject to change

    2- Drupal.org handbook or developer documentation:
    A dedicated page under Menus or API > System > Menu System
    More detailed and user-friendly, good for those exploring how menu links are built and ordered

    Thanks,
    Arun

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Not sure NR is the correct status.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia arunsahijpal

    @smustgrave could you please guide me with best approach here.

Production build 0.71.5 2024