You are here

protected function OrderRouteProvider::getCanonicalRoute in Commerce Core 8.2

Gets the canonical route.

Parameters

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

Return value

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

Overrides DefaultHtmlRouteProvider::getCanonicalRoute

File

modules/order/src/OrderRouteProvider.php, line 17

Class

OrderRouteProvider
Provides routes for the Order entity.

Namespace

Drupal\commerce_order

Code

protected function getCanonicalRoute(EntityTypeInterface $entity_type) {
  $route = parent::getCanonicalRoute($entity_type);

  // Replace the 'full' view mode with the 'admin' view mode.
  $route
    ->setDefault('_entity_view', 'commerce_order.admin');

  // The canonical route is the admin view of the order.
  $route
    ->setOption('_admin_route', TRUE);
  return $route;
}