[regression] Menu List Builder getEntityIds() no longer calls getEntityListQuery

Created on 20 December 2023, about 1 year ago
Updated 25 July 2024, 5 months ago

Problem/Motivation

This change was introduced in 10.2 ✨ Sort menu list by menu title Fixed , which alphabetically sorts menus.

This was achieved by modifying getEntityIds() in MenuListBuilder

BEFORE
It inherited from EntityListBuilder

 protected function getEntityIds() {
    return $this->getEntityListQuery()->execute();
  }

AFTER


protected function getEntityIds() {
    $query = $this
      ->getStorage()
      ->getQuery()
      ->sort('label', 'ASC');

    // Only add the pager if a limit is specified.
    if ($this->limit) {
      $query->pager($this->limit);
    }
    return $query->execute();
  }

This delivers the sorted results, but achieves this by creating its own query instead of modifying $this->getEntityListQuery(). This caused problems on a project I was working on as it relies on customizing getEntityListQuery. I imagine we can still get the benefits introduced in #3070721 by modifying getEntityListQuery instead of introducing a new one.

Steps to reproduce

Proposed resolution

Allow override of the sort key used in \Drupal\Core\Entity\EntityListBuilder::getEntityListQuery.

Remaining tasks

Review
Commit

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ› Bug report
Status

Fixed

Version

10.4 ✨

Component
Menu UIΒ  β†’

Last updated about 1 month ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States bnjmnm Ann Arbor, MI

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024