protected function EntityExportCsvHtmlRouteProvider::getFormRoute in Entity Export CSV 8
Gets the form route.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
string $action: The action form.
Return value
\Symfony\Component\Routing\Route|null The generated route, if available.
1 call to EntityExportCsvHtmlRouteProvider::getFormRoute()
- EntityExportCsvHtmlRouteProvider::getRoutes in src/
EntityExportCsvHtmlRouteProvider.php - Provides routes for entities.
File
- src/
EntityExportCsvHtmlRouteProvider.php, line 49
Class
- EntityExportCsvHtmlRouteProvider
- Provides routes for Entity export csv entities.
Namespace
Drupal\entity_export_csvCode
protected function getFormRoute(EntityTypeInterface $entity_type, $action) {
$link_template = $action;
if ($entity_type
->hasLinkTemplate($link_template)) {
$entity_type_id = $entity_type
->id();
$route = new Route($entity_type
->getLinkTemplate($link_template));
$operation = 'default';
if ($entity_type
->getFormClass($action)) {
$operation = $action;
}
$route
->setDefaults([
'_entity_form' => "{$entity_type_id}.{$operation}",
'_title_callback' => '\\Drupal\\Core\\Entity\\Controller\\EntityController::editTitle',
])
->setRequirement('_entity_access', "{$entity_type_id}.update")
->setOption('parameters', [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
]);
return $route;
}
}