You are here

public function EntityBlock::getDerivativeDefinitions in Entity Blocks 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 DeriverInterface::getDerivativeDefinitions

See also

getDerivativeDefinition()

1 call to EntityBlock::getDerivativeDefinitions()
EntityBlock::getDerivativeDefinition in src/Plugin/Derivative/EntityBlock.php
Gets the definition of a derivative plugin.

File

src/Plugin/Derivative/EntityBlock.php, line 74

Class

EntityBlock
Provides block plugin definitions for all Entity Block block displays.

Namespace

Drupal\entity_block\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entityDefinition) {
    if ($entityDefinition
      ->hasViewBuilderClass()) {
      $delta = $entityDefinition
        ->id();
      $this->derivatives[$delta] = [
        'category' => 'Entity Block',
        'admin_label' => $entityDefinition
          ->getLabel(),
        'config_dependencies' => [
          'config' => [],
        ],
      ];
      $this->derivatives[$delta] += $base_plugin_definition;
    }
  }
  return $this->derivatives;
}