function LanguageConfiguration::getDefaultOptions

Same name in other branches
  1. 9 core/modules/language/src/Element/LanguageConfiguration.php \Drupal\language\Element\LanguageConfiguration::getDefaultOptions()
  2. 8.9.x core/modules/language/src/Element/LanguageConfiguration.php \Drupal\language\Element\LanguageConfiguration::getDefaultOptions()
  3. 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.