You are here

public function CertificateRouteProvider::getCanonicalRoute in Opigno certificate 3.x

Same name and namespace in other branches
  1. 8 src/CertificateRouteProvider.php \Drupal\opigno_certificate\CertificateRouteProvider::getCanonicalRoute()

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/CertificateRouteProvider.php, line 16

Class

CertificateRouteProvider
Provides routes for Certificates.

Namespace

Drupal\opigno_certificate

Code

public function getCanonicalRoute(EntityTypeInterface $entity_type) {
  $route = parent::getCanonicalRoute($entity_type);
  $defaults = $route
    ->getDefaults();
  unset($defaults['_entity_view']);
  $defaults['_controller'] = '\\Drupal\\opigno_certificate\\Controller\\CertificateController::view';
  $route
    ->setDefaults($defaults);
  return $route;
}