You are here

protected function ScheduledTransitionRouteProvider::getRescheduleFormRoute in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x src/Routing/ScheduledTransitionRouteProvider.php \Drupal\scheduled_transitions\Routing\ScheduledTransitionRouteProvider::getRescheduleFormRoute()

Gets the reschedule-form route.

Parameters

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

Return value

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

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

File

src/Routing/ScheduledTransitionRouteProvider.php, line 38

Class

ScheduledTransitionRouteProvider
Route provider for Scheduled Transition entities.

Namespace

Drupal\scheduled_transitions\Routing

Code

protected function getRescheduleFormRoute(EntityTypeInterface $entityType) {

  // We check if it exists in case a third party has unset it.
  if ($entityType
    ->hasLinkTemplate('reschedule-form')) {
    $entityTypeId = $entityType
      ->id();
    $route = new Route($entityType
      ->getLinkTemplate('reschedule-form'));
    $route
      ->addDefaults([
      '_entity_form' => "{$entityTypeId}.reschedule",
      '_title' => 'Reschedule transition',
    ])
      ->setRequirement('_entity_access', "{$entityTypeId}.reschedule")
      ->setRequirement($entityTypeId, '\\d+')
      ->setOption('parameters', [
      $entityTypeId => [
        'type' => 'entity:' . $entityTypeId,
      ],
    ]);
    return $route;
  }
  return NULL;
}