function NodeRouteProvider::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/modules/node/src/Entity/NodeRouteProvider.php, line 48

Class

NodeRouteProvider
Provides routes for nodes.

Namespace

Drupal\node\Entity

Code

protected function getAddFormRoute(EntityTypeInterface $entity_type) {
  if ($route = parent::getAddFormRoute($entity_type)) {
    return $route->setDefault('_title_callback', NodeController::class . '::addPageTitle')
      ->setOption('_node_operation_route', TRUE);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.