function BlockContent::getDerivativeDefinitions
Same name in other branches
- 9 core/modules/block_content/src/Plugin/Derivative/BlockContent.php \Drupal\block_content\Plugin\Derivative\BlockContent::getDerivativeDefinitions()
- 10 core/modules/block_content/src/Plugin/Derivative/BlockContent.php \Drupal\block_content\Plugin\Derivative\BlockContent::getDerivativeDefinitions()
- 11.x core/modules/block_content/src/Plugin/Derivative/BlockContent.php \Drupal\block_content\Plugin\Derivative\BlockContent::getDerivativeDefinitions()
Overrides DeriverBase::getDerivativeDefinitions
File
-
core/
modules/ block_content/ src/ Plugin/ Derivative/ BlockContent.php, line 45
Class
- BlockContent
- Retrieves block plugin definitions for all custom blocks.
Namespace
Drupal\block_content\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$block_contents = $this->blockContentStorage
->loadByProperties([
'reusable' => TRUE,
]);
// Reset the discovered definitions.
$this->derivatives = [];
/** @var $block_content \Drupal\block_content\Entity\BlockContent */
foreach ($block_contents as $block_content) {
$this->derivatives[$block_content->uuid()] = $base_plugin_definition;
$this->derivatives[$block_content->uuid()]['admin_label'] = $block_content->label();
$this->derivatives[$block_content->uuid()]['config_dependencies']['content'] = [
$block_content->getConfigDependencyName(),
];
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.