function LanguageManager::getDefinedLanguageTypesInfo

Same name in other branches
  1. 9 core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getDefinedLanguageTypesInfo()
  2. 8.9.x core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getDefinedLanguageTypesInfo()
  3. 11.x core/lib/Drupal/Core/Language/LanguageManager.php \Drupal\Core\Language\LanguageManager::getDefinedLanguageTypesInfo()

Returns information about all defined language types.

Defines the three core language types:

  • Interface language is the only configurable language type in core. It is used by t() as the default language if none is specified.
  • Content language is by default non-configurable and inherits the interface language negotiated value. It is used by the Field API to determine the display language for fields if no explicit value is specified.
  • URL language is by default non-configurable and is determined through the URL language negotiation method or the URL fallback language negotiation method if no language can be detected. It is used by l() as the default language if none is specified.

Return value

array An associative array of language type information arrays keyed by language type machine name, in the format of hook_language_types_info().

1 call to LanguageManager::getDefinedLanguageTypesInfo()
ConfigurableLanguageManager::getDefinedLanguageTypesInfo in core/modules/language/src/ConfigurableLanguageManager.php
Returns information about all defined language types.
1 method overrides LanguageManager::getDefinedLanguageTypesInfo()
ConfigurableLanguageManager::getDefinedLanguageTypesInfo in core/modules/language/src/ConfigurableLanguageManager.php
Returns information about all defined language types.

File

core/lib/Drupal/Core/Language/LanguageManager.php, line 84

Class

LanguageManager
Class responsible for providing language support on language-unaware sites.

Namespace

Drupal\Core\Language

Code

public function getDefinedLanguageTypesInfo() {
    $this->definedLanguageTypesInfo = [
        LanguageInterface::TYPE_INTERFACE => [
            'name' => new TranslatableMarkup('Interface text'),
            'description' => new TranslatableMarkup('Order of language detection methods for interface text. If a translation of interface text is available in the detected language, it will be displayed.'),
            'locked' => TRUE,
        ],
        LanguageInterface::TYPE_CONTENT => [
            'name' => new TranslatableMarkup('Content'),
            'description' => new TranslatableMarkup('Order of language detection methods for content. If a version of content is available in the detected language, it will be displayed.'),
            'locked' => TRUE,
        ],
        LanguageInterface::TYPE_URL => [
            'locked' => TRUE,
        ],
    ];
    return $this->definedLanguageTypesInfo;
}

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