X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fentity%2Fsrc%2FRouting%2FDeleteMultipleRouteProvider.php;fp=web%2Fmodules%2Fcontrib%2Fentity%2Fsrc%2FRouting%2FDeleteMultipleRouteProvider.php;h=7fb95481a37662617f4164c3254c519283d1be44;hp=0000000000000000000000000000000000000000;hb=f3baf763d342a5f82576890e2a8111a5aaf139dc;hpb=059867c3f96750652c80f39e44c442a58c2549ee diff --git a/web/modules/contrib/entity/src/Routing/DeleteMultipleRouteProvider.php b/web/modules/contrib/entity/src/Routing/DeleteMultipleRouteProvider.php new file mode 100644 index 000000000..7fb95481a --- /dev/null +++ b/web/modules/contrib/entity/src/Routing/DeleteMultipleRouteProvider.php @@ -0,0 +1,54 @@ +deleteMultipleFormRoute($entity_type)) { + $routes->add('entity.' . $entity_type->id() . '.delete_multiple_form', $route); + } + + return $routes; + } + + /** + * 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 deleteMultipleFormRoute(EntityTypeInterface $entity_type) { + // Core requires a "delete-multiple-confirm" form to be declared as well, + // if it's missing, it's safe to assume that the entity type is still + // relying on previous Entity API contrib behavior. + 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', '\Drupal\entity\Form\DeleteMultipleForm'); + $route->setDefault('entity_type_id', $entity_type->id()); + $route->setRequirement('_entity_delete_multiple_access', $entity_type->id()); + + return $route; + } + } + +}