class BlockGroups in Block Group 8
Provides block plugin definitions for blockgroup blocks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\blockgroup\Plugin\Derivative\BlockGroups implements ContainerDeriverInterface
Expanded class hierarchy of BlockGroups
See also
\Drupal\blockgroup\Plugin\Block\BlockGroup.
File
- src/
Plugin/ Derivative/ BlockGroups.php, line 15
Namespace
Drupal\blockgroup\Plugin\DerivativeView source
class BlockGroups extends DeriverBase implements ContainerDeriverInterface {
/**
* The custom block storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $blockGroupStorage;
/**
* Constructs a BlockContent object.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $block_groups_storage
* The custom block storage.
*/
public function __construct(EntityStorageInterface $block_groups_storage) {
$this->blockGroupStorage = $block_groups_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_manager = $container
->get('entity_type.manager');
return new static($entity_manager
->getStorage('block_group_content'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$block_groups = $this->blockGroupStorage
->loadMultiple();
foreach ($block_groups as $block_group) {
$this->derivatives[$block_group
->id()] = $base_plugin_definition;
$this->derivatives[$block_group
->id()]['admin_label'] = $block_group
->label();
$this->derivatives[$block_group
->id()]['config_dependencies'][$block_group
->getConfigDependencyKey()] = [
$block_group
->getConfigDependencyName(),
];
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockGroups:: |
protected | property | The custom block storage. | |
BlockGroups:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
BlockGroups:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
BlockGroups:: |
public | function | Constructs a BlockContent object. | |
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |