You are here

protected function DeleteMultipleRouteProvider::deleteMultipleFormRoute in Entity API 8

Same name and namespace in other branches
  1. 8.0 src/Routing/DeleteMultipleRouteProvider.php \Drupal\entity\Routing\DeleteMultipleRouteProvider::deleteMultipleFormRoute()

Returns the delete multiple form route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to DeleteMultipleRouteProvider::deleteMultipleFormRoute()
DeleteMultipleRouteProvider::getRoutes in src/Routing/DeleteMultipleRouteProvider.php
Provides routes for entities.

File

src/Routing/DeleteMultipleRouteProvider.php, line 40

Class

DeleteMultipleRouteProvider
Provides the HTML route for deleting multiple entities.

Namespace

Drupal\entity\Routing

Code

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;
  }
}