class VersionHistoryLocalTasks

Same name in other branches
  1. 10 core/lib/Drupal/Core/Entity/Plugin/Derivative/VersionHistoryLocalTasks.php \Drupal\Core\Entity\Plugin\Derivative\VersionHistoryLocalTasks

Provides version history local tasks for revisionable entities.

Hierarchy

  • class \Drupal\Core\Entity\Plugin\Derivative\VersionHistoryLocalTasks extends \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface

Expanded class hierarchy of VersionHistoryLocalTasks

1 string reference to 'VersionHistoryLocalTasks'
system.links.task.yml in core/modules/system/system.links.task.yml
core/modules/system/system.links.task.yml

File

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

Namespace

Drupal\Core\Entity\Plugin\Derivative
View source
class VersionHistoryLocalTasks extends DeriverBase implements ContainerDeriverInterface {
    
    /**
     * Creates a new VersionHistoryLocalTasks instance.
     *
     * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
     *   The entity type manager.
     */
    public function __construct(EntityTypeManagerInterface $entityTypeManager) {
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, $base_plugin_id) {
        return new static($container->get('entity_type.manager'));
    }
    
    /**
     * {@inheritdoc}
     */
    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);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Overrides DeriverInterface::getDerivativeDefinition
VersionHistoryLocalTasks::create public static function Overrides ContainerDeriverInterface::create
VersionHistoryLocalTasks::getDerivativeDefinitions public function Overrides DeriverBase::getDerivativeDefinitions
VersionHistoryLocalTasks::__construct public function Creates a new VersionHistoryLocalTasks instance.

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