You are here

public function BlockContent::getDerivativeDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Plugin/Derivative/BlockContent.php \Drupal\block_content\Plugin\Derivative\BlockContent::getDerivativeDefinitions()

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

core/modules/block_content/src/Plugin/Derivative/BlockContent.php, line 50
Contains \Drupal\block_content\Plugin\Derivative\BlockContent.

Class

BlockContent
Retrieves block plugin definitions for all custom blocks.

Namespace

Drupal\block_content\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $block_contents = $this->blockContentStorage
    ->loadMultiple();

  /** @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'] = array(
      $block_content
        ->getConfigDependencyName(),
    );
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}