You are here

public function EntityTestLocalTasks::getDerivativeDefinitions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php \Drupal\entity_test\Plugin\Derivative\EntityTestLocalTasks::getDerivativeDefinitions()

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

core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php, line 20
Contains \Drupal\entity_test\Plugin\Derivative\EntityTestLocalTasks.

Class

EntityTestLocalTasks
Defines the local tasks for all the entity_test entities.

Namespace

Drupal\entity_test\Plugin\Derivative

Code

public function getDerivativeDefinitions($base_plugin_definition) {
  $this->derivatives = array();
  $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING);
  foreach ($types as $entity_type) {
    $this->derivatives[$entity_type . '.canonical'] = array();
    $this->derivatives[$entity_type . '.canonical']['base_route'] = "entity.{$entity_type}.canonical";
    $this->derivatives[$entity_type . '.canonical']['route_name'] = "entity.{$entity_type}.canonical";
    $this->derivatives[$entity_type . '.canonical']['title'] = 'View';
    $this->derivatives[$entity_type . '.edit'] = array();
    $this->derivatives[$entity_type . '.edit']['base_route'] = "entity.{$entity_type}.canonical";
    $this->derivatives[$entity_type . '.edit']['route_name'] = "entity.{$entity_type}.edit_form";
    $this->derivatives[$entity_type . '.edit']['title'] = 'Edit';
  }
  return parent::getDerivativeDefinitions($base_plugin_definition);
}