You are here

public function SimpleBlock::getDerivativeDefinitions in Simple Block 8

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

src/Plugin/Derivative/SimpleBlock.php, line 45

Class

SimpleBlock
Retrieves block plugin definitions for all custom config blocks.

Namespace

Drupal\simple_block\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {

  /** @var \Drupal\simple_block\Entity\SimpleBlock $simple_block */
  foreach ($this->blockConfigStorage
    ->loadMultiple() as $simple_block) {
    $this->derivatives[$simple_block
      ->id()] = $base_plugin_definition;
    $this->derivatives[$simple_block
      ->id()]['admin_label'] = $simple_block
      ->label();
    $this->derivatives[$simple_block
      ->id()]['config_dependencies'][$simple_block
      ->getConfigDependencyKey()] = [
      $simple_block
        ->getConfigDependencyName(),
    ];
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}