You are here

public function OgMenuBlock::getDerivativeDefinitions in Organic Groups Menu (OG Menu) 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/OgMenuBlock.php, line 52
Contains \Drupal\system\Plugin\Derivative\SystemMenuBlock.

Class

OgMenuBlock
Provides block plugin definitions for custom menus.

Namespace

Drupal\og_menu\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {

  /**
   * @var string $menu
   * @var \Drupal\og_menu\Entity\OgMenuInstance $entity
   */
  foreach ($this->menuStorage
    ->loadMultiple() as $menu => $entity) {
    if (!Og::isGroupContent('ogmenu_instance', $entity
      ->id())) {
      continue;
    }
    $this->derivatives[$menu] = $base_plugin_definition;
    $this->derivatives[$menu]['admin_label'] = $entity
      ->label();
    $this->derivatives[$menu]['config_dependencies']['config'] = array(
      $entity
        ->getConfigDependencyName(),
    );
  }
  return $this->derivatives;
}