* - edit-form
* - delete-form
* - collection
+ * - delete-multiple-form
*
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider.
*/
$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;
}
$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', [
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;
+ }
+ }
+
}