Problem/Motivation

Three config/content entities in the main module declare a list_builder handler whose class lives in the optional display_builder_ui submodule:

  • src/Entity/Instance.php: Drupal\display_builder_ui\InstanceListBuilder
  • src/Entity/PatternPreset.php: Drupal\display_builder_ui\PatternPresetListBuilder
  • src/Entity/Profile.php: Drupal\display_builder_ui\ProfileListBuilder

It does not fatal today, because ::class is a string and the handler is only instantiated on demand. But the main module depends on a submodule it does not require, and any code calling getListBuilder() on these entity types without display_builder_ui gets a class-not-found error instead of a clean "no handler".

display_builder_ui already owns the rest of this surface: its entity_type_alter hook (DisplayBuilderUiHooks::entityTypeAlter()) sets the collection, add-form, edit-form and delete-form link templates for the same three entity types. The list builders are the only part left behind.

Found while fixing #3624842: InstancesPanel RouteNotFoundException when no display_builder_ui.

Proposed resolution

  • Remove the list_builder handler and the display_builder_ui imports from the three entity attributes.
  • Set them in DisplayBuilderUiHooks::entityTypeAlter() with setListBuilderClass(), next to the link templates.
  • Kernel test: with display_builder_ui off, hasListBuilderClass() is FALSE for all three; with it on, TRUE.

Remaining tasks

  • Check PatternPreset form handlers too: confirm PatternPresetForm lives in the main module, or move it the same way.

Comments

mogtofu33 created an issue.