function BlockRepository::__construct

Same name and namespace in other branches
  1. 11.x core/modules/block/src/BlockRepository.php \Drupal\block\BlockRepository::__construct()
  2. 10 core/modules/block/src/BlockRepository.php \Drupal\block\BlockRepository::__construct()
  3. 9 core/modules/block/src/BlockRepository.php \Drupal\block\BlockRepository::__construct()
  4. 8.9.x core/modules/block/src/BlockRepository.php \Drupal\block\BlockRepository::__construct()

Constructs a new BlockRepository.

Parameters

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

\Drupal\Core\Theme\ThemeManagerInterface $themeManager: The theme manager.

\Drupal\Core\Plugin\Context\ContextHandlerInterface $contextHandler: The plugin context handler.

File

core/modules/block/src/BlockRepository.php, line 32

Class

BlockRepository
Provides a repository for Block config entities.

Namespace

Drupal\block

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, protected ThemeManagerInterface $themeManager, protected ContextHandlerInterface $contextHandler) {
  $this->blockStorage = $entity_type_manager->getStorage('block');
}

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