LibraryItemRouteProvider.php in Paragraphs 8
File
modules/paragraphs_library/src/Routing/LibraryItemRouteProvider.php
View source
<?php
namespace Drupal\paragraphs_library\Routing;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;
class LibraryItemRouteProvider extends DefaultHtmlRouteProvider {
public function getRoutes(EntityTypeInterface $entity_type) {
$route_collection = parent::getRoutes($entity_type);
if ($canonical_route = $route_collection
->get("entity.{$entity_type->id()}.canonical")) {
$canonical_route
->setOption('_admin_route', FALSE);
$canonical_route
->addRequirements([
'_permission' => 'administer paragraphs library+create paragraph library item+edit paragraph library item',
]);
}
return $route_collection;
}
}