class BlockFieldManager in Block field 8
Defines a service that manages block plugins for the block field.
Hierarchy
- class \Drupal\block_field\BlockFieldManager implements BlockFieldManagerInterface
Expanded class hierarchy of BlockFieldManager
1 string reference to 'BlockFieldManager'
1 service uses BlockFieldManager
File
- src/
BlockFieldManager.php, line 11
Namespace
Drupal\block_fieldView source
class BlockFieldManager implements BlockFieldManagerInterface {
/**
* The block plugin manager.
*
* @var \Drupal\Core\Block\BlockManagerInterface
*/
protected $blockManager;
/**
* The context repository.
*
* @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface
*/
protected $contextRepository;
/**
* Constructs a new BlockFieldManager.
*
* @param \Drupal\Core\Block\BlockManagerInterface $block_manager
* The block plugin manager.
* @param \Drupal\Core\Plugin\Context\ContextRepositoryInterface $context_repository
* The context repository.
*/
public function __construct(BlockManagerInterface $block_manager, ContextRepositoryInterface $context_repository) {
$this->blockManager = $block_manager;
$this->contextRepository = $context_repository;
}
/**
* {@inheritdoc}
*/
public function getBlockDefinitions() {
$definitions = $this->blockManager
->getDefinitionsForContexts($this->contextRepository
->getAvailableContexts());
return $this->blockManager
->getSortedDefinitions($definitions);
}
/**
* {@inheritdoc}
*/
public function getBlockCategories() {
return $this->blockManager
->getCategories();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockFieldManager:: |
protected | property | The block plugin manager. | |
BlockFieldManager:: |
protected | property | The context repository. | |
BlockFieldManager:: |
public | function |
Get list of all block categories. Overrides BlockFieldManagerInterface:: |
|
BlockFieldManager:: |
public | function |
Get sorted listed of supported block definitions. Overrides BlockFieldManagerInterface:: |
|
BlockFieldManager:: |
public | function | Constructs a new BlockFieldManager. |