You are here

protected static function LanguageConfiguration::getDefaultOptions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/language/src/Element/LanguageConfiguration.php \Drupal\language\Element\LanguageConfiguration::getDefaultOptions()
  2. 10 core/modules/language/src/Element/LanguageConfiguration.php \Drupal\language\Element\LanguageConfiguration::getDefaultOptions()

Returns the default options for the language configuration form element.

Return value

array An array containing the default options.

1 call to LanguageConfiguration::getDefaultOptions()
LanguageConfiguration::processLanguageConfiguration in core/modules/language/src/Element/LanguageConfiguration.php
Process handler for the language_configuration form element.

File

core/modules/language/src/Element/LanguageConfiguration.php, line 92

Class

LanguageConfiguration
Defines an element for language configuration for a single field.

Namespace

Drupal\language\Element

Code

protected static function getDefaultOptions() {
  $language_options = [
    LanguageInterface::LANGCODE_SITE_DEFAULT => t("Site's default language (@language)", [
      '@language' => static::languageManager()
        ->getDefaultLanguage()
        ->getName(),
    ]),
    'current_interface' => t('Interface text language selected for page'),
    'authors_default' => t("Author's preferred language"),
  ];
  $languages = static::languageManager()
    ->getLanguages(LanguageInterface::STATE_ALL);
  foreach ($languages as $langcode => $language) {
    $language_options[$langcode] = $language
      ->isLocked() ? t('- @name -', [
      '@name' => $language
        ->getName(),
    ]) : $language
      ->getName();
  }
  return $language_options;
}