protected function EntityFlagActionRouteProvider::getEntityFlagFormRoute in farmOS 2.x
Gets the entity flag form route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
Return value
\Symfony\Component\Routing\Route|null The generated route, if available.
1 call to EntityFlagActionRouteProvider::getEntityFlagFormRoute()
- EntityFlagActionRouteProvider::getRoutes in modules/
core/ flag/ src/ Routing/ EntityFlagActionRouteProvider.php - Provides routes for entities.
File
- modules/
core/ flag/ src/ Routing/ EntityFlagActionRouteProvider.php, line 37
Class
- EntityFlagActionRouteProvider
- Provides routes for the entity flag action.
Namespace
Drupal\farm_flag\RoutingCode
protected function getEntityFlagFormRoute(EntityTypeInterface $entity_type) {
if ($entity_type
->hasLinkTemplate('flag-action-form')) {
$route = new Route($entity_type
->getLinkTemplate('flag-action-form'));
$route
->setDefault('_form', $entity_type
->getFormClass('flag-action-form'));
$route
->setDefault('entity_type_id', $entity_type
->id());
$route
->setRequirement('_user_is_logged_in', 'TRUE');
return $route;
}
}