class FixedBlockContent in Fixed Block Content 8
Same name in this branch
- 8 src/Entity/FixedBlockContent.php \Drupal\fixed_block_content\Entity\FixedBlockContent
- 8 src/Plugin/Derivative/FixedBlockContent.php \Drupal\fixed_block_content\Plugin\Derivative\FixedBlockContent
Retrieves block plugin definitions for all custom config blocks.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\fixed_block_content\Plugin\Derivative\FixedBlockContent implements ContainerDeriverInterface
Expanded class hierarchy of FixedBlockContent
File
- src/
Plugin/ Derivative/ FixedBlockContent.php, line 13
Namespace
Drupal\fixed_block_content\Plugin\DerivativeView source
class FixedBlockContent extends DeriverBase implements ContainerDeriverInterface {
/**
* The custom config block storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $blockConfigStorage;
/**
* Constructs a BlockContent object.
*
* @param \Drupal\Core\Entity\EntityStorageInterface $block_content_storage
* The custom block storage.
*/
public function __construct(EntityStorageInterface $block_content_storage) {
$this->blockConfigStorage = $block_content_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$entity_type_manager = $container
->get('entity_type.manager');
return new static($entity_type_manager
->getStorage('fixed_block_content'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
/** @var \Drupal\fixed_block_content\FixedBlockContentInterface $fixed_block */
foreach ($this->blockConfigStorage
->loadMultiple() as $fixed_block) {
$this->derivatives[$fixed_block
->id()] = $base_plugin_definition;
$this->derivatives[$fixed_block
->id()]['admin_label'] = $fixed_block
->label();
$this->derivatives[$fixed_block
->id()]['config_dependencies'][$fixed_block
->getConfigDependencyKey()] = [
$fixed_block
->getConfigDependencyName(),
];
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
FixedBlockContent:: |
protected | property | The custom config block storage. | |
FixedBlockContent:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
FixedBlockContent:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
FixedBlockContent:: |
public | function | Constructs a BlockContent object. |