You are here

public function SystemMenuBlock::getDerivativeDefinitions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php \Drupal\system\Plugin\Derivative\SystemMenuBlock::getDerivativeDefinitions()
  2. 10 core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php \Drupal\system\Plugin\Derivative\SystemMenuBlock::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/system/src/Plugin/Derivative/SystemMenuBlock.php, line 46

Class

SystemMenuBlock
Provides block plugin definitions for custom menus.

Namespace

Drupal\system\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  foreach ($this->menuStorage
    ->loadMultiple() as $menu => $entity) {
    $this->derivatives[$menu] = $base_plugin_definition;
    $this->derivatives[$menu]['admin_label'] = $entity
      ->label();
    $this->derivatives[$menu]['config_dependencies']['config'] = [
      $entity
        ->getConfigDependencyName(),
    ];
  }
  return $this->derivatives;
}