BrokenHtmlRouteProvider.php in Entity Form Cancel Button 8
File
tests/modules/cancel_button_test/src/Entity/Routing/BrokenHtmlRouteProvider.php
View source
<?php
namespace Drupal\cancel_button_test\Entity\Routing;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;
class BrokenHtmlRouteProvider extends DefaultHtmlRouteProvider {
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;
}
}