You are here

protected function WundergroundWeatherSettingsForm::getLanguages in Wunderground weather 8

Get the languages used on the current site.

Return value

array An array of languages to be used in a select element.

1 call to WundergroundWeatherSettingsForm::getLanguages()
WundergroundWeatherSettingsForm::buildForm in src/Form/WundergroundWeatherSettingsForm.php
Form constructor.

File

src/Form/WundergroundWeatherSettingsForm.php, line 138
Contains \Drupal\wunderground_weather\Form\wunderground_weatherSettingsForm.

Class

WundergroundWeatherSettingsForm
Defines a form to configure module settings.

Namespace

Drupal\wunderground_weather\Form

Code

protected function getLanguages() {
  $languages = $this->languageManager
    ->getLanguages();
  $options_array = [];

  /** @var \Drupal\Core\Language\Language $language */
  foreach ($languages as $language) {
    $options_array[$language
      ->getId()] = $language
      ->getName();
  }
  return $options_array;
}