X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FRouting%2FDefaultHtmlRouteProvider.php;h=1415a1aba66ad13459a94f28d32a4930a5a0eb24;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=fb40fd5b4ac31ec3235f0f35f259b963bc4b8122;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php b/web/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php index fb40fd5b4..1415a1aba 100644 --- a/web/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php +++ b/web/core/lib/Drupal/Core/Entity/Routing/DefaultHtmlRouteProvider.php @@ -24,6 +24,7 @@ use Symfony\Component\Routing\RouteCollection; * - edit-form * - delete-form * - collection + * - delete-multiple-form * * @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider. */ @@ -98,6 +99,10 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa $collection->add("entity.{$entity_type_id}.collection", $collection_route); } + if ($delete_multiple_route = $this->getDeleteMultipleFormRoute($entity_type)) { + $collection->add('entity.' . $entity_type->id() . '.delete_multiple_form', $delete_multiple_route); + } + return $collection; } @@ -253,7 +258,7 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa $route ->setDefaults([ '_entity_form' => "{$entity_type_id}.{$operation}", - '_title_callback' => '\Drupal\Core\Entity\Controller\EntityController::editTitle' + '_title_callback' => '\Drupal\Core\Entity\Controller\EntityController::editTitle', ]) ->setRequirement('_entity_access', "{$entity_type_id}.update") ->setOption('parameters', [ @@ -350,4 +355,23 @@ class DefaultHtmlRouteProvider implements EntityRouteProviderInterface, EntityHa return $field_storage_definitions[$entity_type->getKey('id')]->getType(); } + /** + * Returns the delete multiple form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getDeleteMultipleFormRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('delete-multiple-form') && $entity_type->hasHandlerClass('form', 'delete-multiple-confirm')) { + $route = new Route($entity_type->getLinkTemplate('delete-multiple-form')); + $route->setDefault('_form', $entity_type->getFormClass('delete-multiple-confirm')); + $route->setDefault('entity_type_id', $entity_type->id()); + $route->setRequirement('_entity_delete_multiple_access', $entity_type->id()); + return $route; + } + } + }