You are here

protected function ProductVariationRouteProvider::getCollectionRoute in Commerce Core 8.2

Gets the collection route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

Overrides DefaultHtmlRouteProvider::getCollectionRoute

File

modules/product/src/ProductVariationRouteProvider.php, line 80

Class

ProductVariationRouteProvider
Provides routes for the product variation entity.

Namespace

Drupal\commerce_product

Code

protected function getCollectionRoute(EntityTypeInterface $entity_type) {
  $route = new Route($entity_type
    ->getLinkTemplate('collection'));
  $route
    ->addDefaults([
    '_entity_list' => 'commerce_product_variation',
    '_title_callback' => ProductVariationController::class . '::collectionTitle',
  ])
    ->setRequirement('_product_variation_collection_access', 'TRUE')
    ->setOption('parameters', [
    'commerce_product' => [
      'type' => 'entity:commerce_product',
    ],
  ])
    ->setOption('_admin_route', TRUE);
  return $route;
}