diff --git a/core/modules/layout_builder/src/InlineBlockEntityOperations.php b/core/modules/layout_builder/src/InlineBlockEntityOperations.php index bb709a85cc..a8eafeff8d 100644 --- a/core/modules/layout_builder/src/InlineBlockEntityOperations.php +++ b/core/modules/layout_builder/src/InlineBlockEntityOperations.php @@ -59,13 +59,22 @@ class InlineBlockEntityOperations implements ContainerInjectionInterface { * @param \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface $section_storage_manager * The section storage manager. * @param \Drupal\Core\Block\BlockManagerInterface|null $block_manager - * The block manager; + * (optional) The block manager; + * + * @todo This constructor has one optional parameter, $block_manager. Deprecate the current + * constructor signature in https://www.drupal.org/node/3031492 after the + * general policy for constructor backwards compatibility is determined in + * https://www.drupal.org/node/3030640. */ - public function __construct(EntityTypeManagerInterface $entityTypeManager, InlineBlockUsageInterface $usage, SectionStorageManagerInterface $section_storage_manager, BlockManagerInterface $block_manager) { + public function __construct(EntityTypeManagerInterface $entityTypeManager, InlineBlockUsageInterface $usage, SectionStorageManagerInterface $section_storage_manager, BlockManagerInterface $block_manager = NULL) { $this->entityTypeManager = $entityTypeManager; $this->blockContentStorage = $entityTypeManager->getStorage('block_content'); $this->usage = $usage; $this->sectionStorageManager = $section_storage_manager; + if ($block_manager === NULL) { + @trigger_error('The plugin.manager.block service must be passed to \Drupal\layout_builder\InlineBlockEntityOperations::__construct(). It was added in Drupal 9.1.0 and will be required before Drupal 10.0.0.', E_USER_DEPRECATED); + $block_manager = \Drupal::service('plugin.manager.block'); + } $this->blockManager = $block_manager; }