You are here

class LanguageNegotiationUI in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI
  2. 9 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI

Identifies the language from the interface text language selected for page.

Plugin annotation


@LanguageNegotiation(
  id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI::METHOD_ID,
  types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT},
  weight = 9,
  name = @Translation("Interface"),
  description = @Translation("Use the detected interface language.")
)

Hierarchy

Expanded class hierarchy of LanguageNegotiationUI

4 files declare their use of LanguageNegotiationUI
language.module in core/modules/language/language.module
Add language handling functionality to Drupal.
LanguageNegotiationInfoTest.php in core/modules/language/tests/src/Functional/LanguageNegotiationInfoTest.php
LanguageNegotiator.php in core/modules/language/src/LanguageNegotiator.php
language_test.module in core/modules/language/tests/language_test/language_test.module
Mock module for language layer tests.

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php, line 19

Namespace

Drupal\language\Plugin\LanguageNegotiation
View source
class LanguageNegotiationUI extends LanguageNegotiationMethodBase {

  /**
   * The language negotiation method id.
   */
  const METHOD_ID = 'language-interface';

  /**
   * {@inheritdoc}
   */
  public function getLangcode(Request $request = NULL) {
    return $this->languageManager ? $this->languageManager
      ->getCurrentLanguage()
      ->getId() : NULL;
  }

}

Members