You are here

protected function AdminHtmlRouteProvider::getAddFormRoute in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Routing/AdminHtmlRouteProvider.php \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getAddFormRoute()
  2. 9 core/lib/Drupal/Core/Entity/Routing/AdminHtmlRouteProvider.php \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider::getAddFormRoute()

Gets the add-form 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::getAddFormRoute

File

core/lib/Drupal/Core/Entity/Routing/AdminHtmlRouteProvider.php, line 30

Class

AdminHtmlRouteProvider
Provides HTML routes for entities with administrative add/edit/delete pages.

Namespace

Drupal\Core\Entity\Routing

Code

protected function getAddFormRoute(EntityTypeInterface $entity_type) {
  if ($route = parent::getAddFormRoute($entity_type)) {
    $route
      ->setOption('_admin_route', TRUE);
    return $route;
  }
}