You are here

protected function ShipmentRouteProvider::getAddPageRoute in Commerce Shipping 8.2

Gets the add page route.

Built only for entity types that have bundles.

Parameters

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

Return value

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

Overrides DefaultHtmlRouteProvider::getAddPageRoute

File

src/ShipmentRouteProvider.php, line 81

Class

ShipmentRouteProvider
Provides routes for the Shipment entity.

Namespace

Drupal\commerce_shipping

Code

protected function getAddPageRoute(EntityTypeInterface $entity_type) {
  $route = parent::getAddPageRoute($entity_type);
  if ($route) {
    $route
      ->setDefault('_controller', ShipmentController::class . '::addShipmentPage');
    $route
      ->setOption('parameters', [
      'commerce_order' => [
        'type' => 'entity:commerce_order',
      ],
    ]);
  }
  return $route;
}