You are here

public function DomainMenuAccessMenuBlock::getDerivativeDefinitions in Domain Menu Access 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 SystemMenuBlock::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Derivative/DomainMenuAccessMenuBlock.php, line 51

Class

DomainMenuAccessMenuBlock
Provides block plugin definitions for domain access menus.

Namespace

Drupal\domain_menu_access\Plugin\Derivative

Code

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