protected DefaultHtmlRouteProvider::getAddPageRoute(EntityTypeInterface $entity_type)
Gets the add page route.
Built only for entity types that have bundles.
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.
\Symfony\Component\Routing\Route|null The generated route, if available.
protected function getAddPageRoute(EntityTypeInterface $entity_type) { if ($entity_type->hasLinkTemplate('add-page') && $entity_type->getKey('bundle')) { $route = new Route($entity_type->getLinkTemplate('add-page')); $route->setDefault('_controller', EntityController::class . '::addPage'); $route->setDefault('_title_callback', EntityController::class . '::addTitle'); $route->setDefault('entity_type_id', $entity_type->id()); $route->setRequirement('_entity_create_any_access', $entity_type->id()); return $route; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Routing!DefaultHtmlRouteProvider.php/function/DefaultHtmlRouteProvider::getAddPageRoute/8.1.x