function VersionHistoryLocalTasks::getDerivativeDefinitions

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Entity/Plugin/Derivative/VersionHistoryLocalTasks.php \Drupal\Core\Entity\Plugin\Derivative\VersionHistoryLocalTasks::getDerivativeDefinitions()

Overrides DeriverBase::getDerivativeDefinitions

File

core/lib/Drupal/Core/Entity/Plugin/Derivative/VersionHistoryLocalTasks.php, line 38

Class

VersionHistoryLocalTasks
Provides version history local tasks for revisionable entities.

Namespace

Drupal\Core\Entity\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('version-history')) {
            continue;
        }
        $this->derivatives["{$entity_type_id}.version_history"] = [
            'route_name' => "entity.{$entity_type_id}.version_history",
            'base_route' => "entity.{$entity_type_id}.canonical",
        ] + $base_plugin_definition;
    }
    return parent::getDerivativeDefinitions($base_plugin_definition);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.