You are here

public function EckEntityContentLocalTask::getDerivativeDefinitions in Entity Construction Kit (ECK) 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/EckEntityContentLocalTask.php, line 43

Class

EckEntityContentLocalTask
Provides local task definitions for all entity bundles.

Namespace

Drupal\eck\Plugin\Derivative

Code

public function getDerivativeDefinitions($basePluginDefinition) {
  $this->basePluginDefinition = $basePluginDefinition;
  $derivatives = [];

  /** @var \Drupal\eck\Entity\EckEntityType $type */
  foreach (EckEntityType::loadMultiple() as $type) {
    $entity_type = $type
      ->id();
    $base_route = "entity.{$entity_type}.canonical";
    $derivative = $this
      ->createDerivativeDefinition("entity.{$entity_type}.canonical", 1, 'View', $base_route);
    $derivatives["{$entity_type}.eck_canonical_tab"] = $derivative;
    $derivative = $this
      ->createDerivativeDefinition("entity.{$entity_type}.edit_form", 2, 'Edit', $base_route);
    $derivatives["{$entity_type}.eck_edit_tab"] = $derivative;
    $derivative = $this
      ->createDerivativeDefinition("entity.{$entity_type}.delete_form", 3, 'Delete', $base_route);
    $derivatives["{$entity_type}.eck_delete_tab"] = $derivative;
  }
  return $derivatives;
}