You are here

protected function CurrencyRouteProvider::getAddFormRoute in Price 3.x

Same name and namespace in other branches
  1. 8 src/CurrencyRouteProvider.php \Drupal\price\CurrencyRouteProvider::getAddFormRoute()
  2. 2.0.x src/CurrencyRouteProvider.php \Drupal\price\CurrencyRouteProvider::getAddFormRoute()
  3. 2.x src/CurrencyRouteProvider.php \Drupal\price\CurrencyRouteProvider::getAddFormRoute()
  4. 3.0.x src/CurrencyRouteProvider.php \Drupal\price\CurrencyRouteProvider::getAddFormRoute()

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/CurrencyRouteProvider.php, line 16

Class

CurrencyRouteProvider
Provides routes for the Currency entity.

Namespace

Drupal\price

Code

protected function getAddFormRoute(EntityTypeInterface $entity_type) {
  $route = parent::getAddFormRoute($entity_type);

  // Replace the "Add currency" title with "Add custom currency".
  // 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 custom currency')
    ->getUntranslatedString());
  return $route;
}