You are here

public function RedhenConnectionLocalTask::getDerivativeDefinitions in RedHen CRM 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

modules/redhen_connection/src/Plugin/Derivative/RedhenConnectionLocalTask.php, line 54

Class

RedhenConnectionLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\redhen_connection\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = [];
  foreach ($this->service
    ->getAllConnectionEntityTypes() as $entity_type_id => $entity_type) {
    if (!$entity_type
      ->hasLinkTemplate('redhen_connection')) {
      continue;
    }
    $this->derivatives["{$entity_type_id}.redhen_connection_tab"] = [
      'route_name' => "entity.{$entity_type_id}.redhen_connection",
      'title' => $this
        ->t('Connections'),
      'base_route' => "entity.{$entity_type_id}.canonical",
      'weight' => 20,
    ] + $base_plugin_definition;
  }
  return $this->derivatives;
}