You are here

class EntityTestLocalTasks in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php \Drupal\entity_test\Plugin\Derivative\EntityTestLocalTasks

Defines the local tasks for all the entity_test entities.

Hierarchy

Expanded class hierarchy of EntityTestLocalTasks

1 string reference to 'EntityTestLocalTasks'
entity_test.links.task.yml in core/modules/system/tests/modules/entity_test/entity_test.links.task.yml
core/modules/system/tests/modules/entity_test/entity_test.links.task.yml

File

core/modules/system/tests/modules/entity_test/src/Plugin/Derivative/EntityTestLocalTasks.php, line 10

Namespace

Drupal\entity_test\Plugin\Derivative
View source
class EntityTestLocalTasks extends DeriverBase {

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = [];
    $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING);
    foreach ($types as $entity_type) {
      $this->derivatives[$entity_type . '.canonical'] = [];
      $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'] = [];
      $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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
EntityTestLocalTasks::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions