You are here

protected function PriceListItemRouteProvider::getAddFormRoute in Commerce Pricelist 8.2

Gets the add-form 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::getAddFormRoute

File

src/PriceListItemRouteProvider.php, line 37

Class

PriceListItemRouteProvider
Provides routes for the price list item entity.

Namespace

Drupal\commerce_pricelist

Code

protected function getAddFormRoute(EntityTypeInterface $entity_type) {
  $route = parent::getAddFormRoute($entity_type);
  $route
    ->setOption('parameters', [
    'commerce_pricelist' => [
      'type' => 'entity:commerce_pricelist',
    ],
  ]);

  // Replace the "Add price list item" title with "Add price".
  // The t() function is used to ensure the string is picked up for
  // translation, even though _title is supposed to be untranslated.
  $route
    ->setDefault('_title_callback', '');
  $route
    ->setDefault('_title', t('Add price')
    ->getUntranslatedString());
  return $route;
}