function InlineBlockEntityOperations::__construct

Same name in other branches
  1. 9 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::__construct()
  2. 10 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::__construct()
  3. 11.x core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::__construct()

Constructs a new EntityOperations object.

@todo This constructor has one optional parameter, $section_storage_manager and one totally unused $database parameter. 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.

@todo The current constructor signature is deprecated:

  • The $section_storage_manager parameter is optional, but should become

required.

  • The $database parameter is unused and should be removed.

Deprecate in https://www.drupal.org/node/3031492.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager: The entity type manager service.

\Drupal\layout_builder\InlineBlockUsageInterface $usage: Inline block usage tracking service.

\Drupal\Core\Database\Connection $database: The database connection.

\Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface $section_storage_manager: (optional) The section storage manager.

File

core/modules/layout_builder/src/InlineBlockEntityOperations.php, line 69

Class

InlineBlockEntityOperations
Defines a class for reacting to entity events related to Inline Blocks.

Namespace

Drupal\layout_builder

Code

public function __construct(EntityTypeManagerInterface $entityTypeManager, InlineBlockUsageInterface $usage, Connection $database, SectionStorageManagerInterface $section_storage_manager = NULL) {
    $this->entityTypeManager = $entityTypeManager;
    $this->blockContentStorage = $entityTypeManager->getStorage('block_content');
    $this->usage = $usage;
    if ($section_storage_manager === NULL) {
        @trigger_error('The plugin.manager.layout_builder.section_storage service must be passed to \\Drupal\\layout_builder\\InlineBlockEntityOperations::__construct(). It was added in Drupal 8.7.0 and will be required before Drupal 9.0.0.', E_USER_DEPRECATED);
        $section_storage_manager = \Drupal::service('plugin.manager.layout_builder.section_storage');
    }
    $this->sectionStorageManager = $section_storage_manager;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.