X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Fentity%2Fsrc%2FRouting%2FRevisionRouteProvider.php;fp=web%2Fmodules%2Fcontrib%2Fentity%2Fsrc%2FRouting%2FRevisionRouteProvider.php;h=0000000000000000000000000000000000000000;hb=059867c3f96750652c80f39e44c442a58c2549ee;hp=e3412958c23eeb320ecbac14df927398c44240e8;hpb=f8fc16ae6b862bef59baaad5d051dd37b7ff11b2;p=yaffs-website diff --git a/web/modules/contrib/entity/src/Routing/RevisionRouteProvider.php b/web/modules/contrib/entity/src/Routing/RevisionRouteProvider.php deleted file mode 100644 index e3412958c..000000000 --- a/web/modules/contrib/entity/src/Routing/RevisionRouteProvider.php +++ /dev/null @@ -1,127 +0,0 @@ -id(); - if ($view_route = $this->getRevisionViewRoute($entity_type)) { - $collection->add("entity.$entity_type_id.revision", $view_route); - } - if ($view_route = $this->getRevisionRevertRoute($entity_type)) { - $collection->add("entity.$entity_type_id.revision_revert_form", $view_route); - } - - if ($view_route = $this->getRevisionHistoryRoute($entity_type)) { - $collection->add("entity.$entity_type_id.version_history", $view_route); - } - - return $collection; - } - - /** - * Gets the entity revision view route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionViewRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision')) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('revision')); - $route->addDefaults([ - '_controller' => '\Drupal\Core\Entity\Controller\EntityViewController::viewRevision', - '_title_callback' => '\Drupal\Core\Entity\Controller\EntityController::title', - ]); - $route->addRequirements([ - '_entity_access_revision' => "$entity_type_id.view", - ]); - $route->setOption('parameters', [ - $entity_type->id() => [ - 'type' => 'entity:' . $entity_type->id(), - ], - $entity_type->id() . '_revision' => [ - 'type' => 'entity_revision:' . $entity_type->id(), - ], - ]); - return $route; - } - } - - /** - * Gets the entity revision revert route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionRevertRoute(EntityTypeInterface $entity_type) { - if ($entity_type->hasLinkTemplate('revision-revert-form')) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('revision-revert-form')); - $route->addDefaults([ - '_form' => '\Drupal\entity\Form\RevisionRevertForm', - 'title' => 'Revert to earlier revision', - ]); - $route->addRequirements([ - '_entity_access_revision' => "$entity_type_id.update", - ]); - $route->setOption('parameters', [ - $entity_type->id() => [ - 'type' => 'entity:' . $entity_type->id(), - ], - $entity_type->id() . '_revision' => [ - 'type' => 'entity_revision:' . $entity_type->id(), - ], - ]); - return $route; - } - } - - /** - * Gets the entity revision version history route. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * - * @return \Symfony\Component\Routing\Route|null - * The generated route, if available. - */ - protected function getRevisionHistoryRoute($entity_type) { - if ($entity_type->hasLinkTemplate('version-history')) { - $entity_type_id = $entity_type->id(); - $route = new Route($entity_type->getLinkTemplate('version-history')); - $route->addDefaults([ - '_controller' => '\Drupal\entity\Controller\RevisionOverviewController::revisionOverviewController', - '_title' => 'Revisions', - ]); - $route->setRequirement('_entity_access_revision', "$entity_type_id.list"); - $route->setOption('entity_type_id', $entity_type->id()); - $route->setOption('parameters', [ - $entity_type->id() => [ - 'type' => 'entity:' . $entity_type->id(), - ], - ]); - return $route; - } - } - -}