You are here

CurrencyRouteProvider.php in Price 3.x

Namespace

Drupal\price

File

src/CurrencyRouteProvider.php
View source
<?php

namespace Drupal\price;

use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;

/**
 * Provides routes for the Currency entity.
 */
class CurrencyRouteProvider extends DefaultHtmlRouteProvider {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Classes

Namesort descending Description
CurrencyRouteProvider Provides routes for the Currency entity.