class LibraryItemRouteProvider

Contains routes for library item functionality.

Hierarchy

  • class \Drupal\paragraphs_library\Routing\LibraryItemRouteProvider extends \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider

Expanded class hierarchy of LibraryItemRouteProvider

File

paragraphs/modules/paragraphs_library/src/Routing/LibraryItemRouteProvider.php, line 11

Namespace

Drupal\paragraphs_library\Routing
View source
class LibraryItemRouteProvider extends DefaultHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  public function getRoutes(EntityTypeInterface $entity_type) {
    $route_collection = parent::getRoutes($entity_type);
    if ($canonical_route = $route_collection
      ->get("entity.{$entity_type->id()}.canonical")) {

      // Display library items using default theme.
      $canonical_route
        ->setOption('_admin_route', FALSE);

      // Restrict access to users who are allowed to update the entity.
      $canonical_route
        ->setRequirement('_entity_access', "{$entity_type->id()}.update");
    }
    return $route_collection;
  }

}

Members