class LanguageNegotiationUI

Same name in other branches
  1. 9 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI
  2. 8.9.x core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI
  3. 11.x core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI

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

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 14

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

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
LanguageNegotiationMethodBase::$config protected property The configuration factory.
LanguageNegotiationMethodBase::$currentUser protected property The current active user.
LanguageNegotiationMethodBase::$languageManager protected property The language manager.
LanguageNegotiationMethodBase::persist public function Notifies the plugin that the language code it returned has been accepted. Overrides LanguageNegotiationMethodInterface::persist 1
LanguageNegotiationMethodBase::setConfig public function Injects the configuration factory. Overrides LanguageNegotiationMethodInterface::setConfig
LanguageNegotiationMethodBase::setCurrentUser public function Injects the current user. Overrides LanguageNegotiationMethodInterface::setCurrentUser
LanguageNegotiationMethodBase::setLanguageManager public function Injects the language manager. Overrides LanguageNegotiationMethodInterface::setLanguageManager
LanguageNegotiationUI::getLangcode public function Performs language negotiation. Overrides LanguageNegotiationMethodInterface::getLangcode
LanguageNegotiationUI::METHOD_ID constant The language negotiation method id.

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