3 namespace Drupal\entity\Plugin\Derivative;
5 use Drupal\Component\Plugin\Derivative\DeriverBase;
6 use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
7 use Symfony\Component\DependencyInjection\ContainerInterface;
10 * Provides local tasks for the revision overview.
12 class RevisionsOverviewDeriver extends DeriverBase implements ContainerDeriverInterface {
15 * The entity type manager.
17 * @var \Drupal\Core\Entity\EntityTypeManagerInterface
19 protected $entityTypeManager;
22 * Creates a new RevisionsOverviewDeriver instance.
24 * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
25 * The entity type manager.
27 public function __construct(\Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager) {
28 $this->entityTypeManager = $entityTypeManager;
34 public static function create(ContainerInterface $container, $base_plugin_id) {
36 $container->get('entity_type.manager')
43 public function getDerivativeDefinitions($base_plugin_definition) {
46 $this->derivatives = [];
47 foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) {
48 if (in_array($entity_type_id, $exclude)) {
52 if (!$entity_type->hasLinkTemplate('version-history')) {
56 $this->derivatives[$entity_type_id] = [
57 'route_name' => "entity.$entity_type_id.version_history",
58 'title' => 'Revisions',
59 'base_route' => "entity.$entity_type_id.canonical",
61 ] + $base_plugin_definition;
64 return parent::getDerivativeDefinitions($base_plugin_definition);