You are here

protected function InvoiceRouteProvider::getCanonicalRoute in Commerce Invoice 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

src/InvoiceRouteProvider.php, line 34

Class

InvoiceRouteProvider
Provides routes for the Invoice entity.

Namespace

Drupal\commerce_invoice

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_invoice.admin');
  return $route;
}