getDefaultOperations() in ConfigEntityListBuilder and sub classes should be protected

Created on 29 July 2025, 4 days ago

Problem/Motivation

Found here https://git.drupalcode.org/project/drupal/-/merge_requests/12445#note_55...

EntityListBuilder::getDefaultOperations is protected, but the ConfigEntityListBuilder subclass and all its sub classes override that visibility to public. This seems like an accident when this was initially added in https://git.drupalcode.org/project/drupal/-/commit/b504423ed07e9bb437e96...

Proposed resolution

Change all methods to protected somehow (BC?)

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

entity system

Created by

🇦🇺Australia acbramley

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

Merge Requests

Comments & Activities

  • Issue created by @acbramley
  • 🇮🇳India libbna New Delhi, India

    I will give this a try!

  • 🇮🇳India libbna New Delhi, India

    I’ve only changed the getDefaultOperations() method of the ConfigEntityListBuilder class to protected. Is there any other place where this change needs to be reflected or updated?

  • Pipeline finished with Success
    3 days ago
    Total: 618s
    #560714
  • core/modules/block/src/BlockListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/block_content/src/BlockContentTypeListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/comment/src/CommentTypeListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/field_ui/src/FieldConfigListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/filter/src/FilterFormatListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/image/src/ImageStyleListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/menu_ui/src/MenuListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/node/src/NodeTypeListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/responsive_image/src/ResponsiveImageStyleListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/search/src/SearchPageListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/shortcut/src/ShortcutSetListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/taxonomy/src/VocabularyListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/user/src/RoleListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/views_ui/src/ViewListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    
  • Oh, and a couple content entity list builders override as public as well:

    core/modules/menu_link_content/src/MenuLinkListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    core/modules/menu_link_content/src/MenuLinkListBuilder.php
      public function getDefaultOperations(EntityInterface $entity) {
    
  • I wonder that since these methods are public now, we can't just change them to protected right away, but need to trigger deprecations and add a CR that they will be changed to protected in D12.

  • 🇮🇳India libbna New Delhi, India

    Hi @godotislate thanks for providing the whole list. So instead of changing it to protected should I add deprecated message?

  • 🇨🇭Switzerland berdir Switzerland

    I'm not sure how the deprecation message would work. We'd need the differentiate the between internal and external calls, that sounds complicated and slow (checking backtrace?).

    These were never meant to be called directly and doing so would be result in incomplete and broken results. Making it protected won't break subclasses, it's possible to extend the visibility of a protected method in the parent class.

    I can't find any calls that aren't $this->getDefautOperations(), I'd say we either just do it or we don't bother and leave it?

Production build 0.71.5 2024