public function BrokenHtmlRouteProvider::getRoutes in Entity Form Cancel Button 8
Provides routes for entities.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type
Return value
\Symfony\Component\Routing\RouteCollection|\Symfony\Component\Routing\Route[] Returns a route collection or an array of routes keyed by name, like route_callbacks inside 'routing.yml' files.
Overrides DefaultHtmlRouteProvider::getRoutes
File
- tests/
modules/ cancel_button_test/ src/ Entity/ Routing/ BrokenHtmlRouteProvider.php, line 20
Class
- BrokenHtmlRouteProvider
- Provides HTML routes for test entity types defined in this module.
Namespace
Drupal\cancel_button_test\Entity\RoutingCode
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
$entity_type_id = $entity_type
->id();
if ($this
->getCanonicalRoute($entity_type)) {
$collection
->remove("entity.{$entity_type_id}.canonical");
}
if ($this
->getCollectionRoute($entity_type)) {
$collection
->remove("entity.{$entity_type_id}.collection");
}
return $collection;
}