class ScheduledTransitionRouteProvider in Scheduled Transitions 8
Same name and namespace in other branches
- 2.x src/Routing/ScheduledTransitionRouteProvider.php \Drupal\scheduled_transitions\Routing\ScheduledTransitionRouteProvider
 
Route provider for Scheduled Transition entities.
Hierarchy
- class \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider implements EntityHandlerInterface, EntityRouteProviderInterface
- class \Drupal\scheduled_transitions\Routing\ScheduledTransitionRouteProvider
 
 
Expanded class hierarchy of ScheduledTransitionRouteProvider
File
- src/
Routing/ ScheduledTransitionRouteProvider.php, line 14  
Namespace
Drupal\scheduled_transitions\RoutingView source
class ScheduledTransitionRouteProvider extends DefaultHtmlRouteProvider {
  /**
   * {@inheritdoc}
   */
  public function getRoutes(EntityTypeInterface $entity_type) {
    $collection = parent::getRoutes($entity_type);
    if ($route = $this
      ->getRescheduleFormRoute($entity_type)) {
      $collection
        ->add('entity.scheduled_transition.reschedule_form', $route);
    }
    return $collection;
  }
  /**
   * Gets the reschedule-form route.
   *
   * @param \Drupal\Core\Entity\EntityTypeInterface $entityType
   *   The entity type.
   *
   * @return \Symfony\Component\Routing\Route|null
   *   The generated route, if available.
   */
  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;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            DefaultHtmlRouteProvider:: | 
                  protected | property | The entity field manager. | |
| 
            DefaultHtmlRouteProvider:: | 
                  protected | property | The entity type manager. | |
| 
            DefaultHtmlRouteProvider:: | 
                  public static | function | 
            Instantiates a new instance of this entity handler. Overrides EntityHandlerInterface:: | 
                  1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the add-form route. | 2 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the add page route. | 2 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the canonical route. | 3 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the collection route. | 2 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the delete-form route. | 1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Returns the delete multiple form route. | 1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the edit-form route. | 1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  protected | function | Gets the type of the ID key for a given entity type. | 1 | 
| 
            DefaultHtmlRouteProvider:: | 
                  public | function | Constructs a new DefaultHtmlRouteProvider. | 1 | 
| 
            ScheduledTransitionRouteProvider:: | 
                  protected | function | Gets the reschedule-form route. | |
| 
            ScheduledTransitionRouteProvider:: | 
                  public | function | 
            Provides routes for entities. Overrides DefaultHtmlRouteProvider:: |