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\InstanceListBuildersrc/Entity/PatternPreset.php:Drupal\display_builder_ui\PatternPresetListBuildersrc/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_builderhandler and thedisplay_builder_uiimports from the three entity attributes. - Set them in
DisplayBuilderUiHooks::entityTypeAlter()withsetListBuilderClass(), next to the link templates. - Kernel test: with
display_builder_uioff,hasListBuilderClass()is FALSE for all three; with it on, TRUE.
Remaining tasks
- Check
PatternPresetform handlers too: confirmPatternPresetFormlives in the main module, or move it the same way.
Comments