You are here

public function CurrencyLocale::label in Currency 8.3

Gets the label of the entity.

Return value

string|null The label of the entity, or NULL if there is no label defined.

Overrides EntityBase::label

File

src/Entity/CurrencyLocale.php, line 169

Class

CurrencyLocale
Defines a currency locale entity.

Namespace

Drupal\currency\Entity

Code

public function label() {
  $languages = LanguageManager::getStandardLanguageList();
  $countries = $this
    ->getCountryManager()
    ->getList();
  return $this
    ->t('@language (@country)', [
    '@language' => isset($languages[$this
      ->getLanguageCode()]) ? $languages[$this
      ->getLanguageCode()][0] : $this
      ->getLanguageCode(),
    '@country' => isset($countries[$this
      ->getCountryCode()]) ? $countries[$this
      ->getCountryCode()] : $this
      ->getCountryCode(),
  ]);
}