protected function AgreementRouteProvider::getCanonicalRouteForEntity in Agreement 3.0.x
Same name and namespace in other branches
- 8.2 src/Entity/Routing/AgreementRouteProvider.php \Drupal\agreement\Entity\Routing\AgreementRouteProvider::getCanonicalRouteForEntity()
Get the route information from the agreement entity.
Parameters
\Drupal\agreement\Entity\Agreement $agreement: The agreement entity.
Return value
\Symfony\Component\Routing\Route|null A route object.
1 call to AgreementRouteProvider::getCanonicalRouteForEntity()
- AgreementRouteProvider::getRoutes in src/
Entity/ Routing/ AgreementRouteProvider.php - Provides routes for entities.
File
- src/
Entity/ Routing/ AgreementRouteProvider.php, line 65
Class
- AgreementRouteProvider
- Provide routes for each agreement entity.
Namespace
Drupal\agreement\Entity\RoutingCode
protected function getCanonicalRouteForEntity(Agreement $agreement) {
$route = new Route($agreement
->get('path'));
$route
->addDefaults([
'_form' => '\\Drupal\\agreement\\Form\\AgreementForm',
'_title_callback' => '\\Drupal\\agreement\\Form\\AgreementForm::title',
'agreement' => $agreement
->id(),
])
->setRequirements([
'_permission' => 'access content',
])
->setOption('parameters', [
'agreement' => [
'type' => 'entity:agreement',
],
]);
return $route;
}