You are here

public function DevelLocalTask::getDerivativeDefinitions in Token 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/DevelLocalTask.php, line 36

Class

DevelLocalTask

Namespace

Drupal\token\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  foreach ($this->entityTypeManager
    ->getDefinitions() as $entity_type_id => $entity_type) {
    if ($entity_type
      ->hasLinkTemplate('token-devel')) {
      $this->derivatives["{$entity_type_id}.token_devel_tab"] = [
        'route_name' => "entity.{$entity_type_id}.token_devel",
        'weight' => 110,
        'title' => $this
          ->t('Tokens'),
        'parent_id' => "devel.entities:{$entity_type_id}.devel_tab",
      ];
    }
  }
  foreach ($this->derivatives as &$entry) {
    $entry += $base_plugin_definition;
  }
  return $this->derivatives;
}