LanguageManager::getDefinedLanguageTypesInfo

public 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().

Overrides LanguageManagerInterface::getDefinedLanguageTypesInfo

File

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

Class

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

Namespace

Drupal\Core\Language

Code

public function getDefinedLanguageTypesInfo() {
  $this->definedLanguageTypesInfo = array(
    LanguageInterface::TYPE_INTERFACE => array(
      '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 => array(
      '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 => array(
      'locked' => TRUE,
    ),
  );

  return $this->definedLanguageTypesInfo;
}
doc_Drupal
2016-10-29 09:22:37
Comments
Leave a Comment

Please login to continue.