class LanguageNegotiationSelected

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

Class for identifying language from a selected language.

Hierarchy

Expanded class hierarchy of LanguageNegotiationSelected

3 files declare their use of LanguageNegotiationSelected
LanguageUILanguageNegotiationTest.php in core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
LinksetControllerMultiLingualTest.php in core/modules/system/tests/src/Functional/Menu/LinksetControllerMultiLingualTest.php
NegotiationConfigureForm.php in core/modules/language/src/Form/NegotiationConfigureForm.php

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php, line 13

Namespace

Drupal\language\Plugin\LanguageNegotiation
View source
class LanguageNegotiationSelected extends LanguageNegotiationMethodBase {
    
    /**
     * The language negotiation method id.
     */
    const METHOD_ID = 'language-selected';
    
    /**
     * {@inheritdoc}
     */
    public function getLangcode(?Request $request = NULL) {
        $langcode = NULL;
        if ($this->languageManager) {
            $langcode = $this->config
                ->get('language.negotiation')
                ->get('selected_langcode');
        }
        return $langcode;
    }

}

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
LanguageNegotiationSelected::getLangcode public function Performs language negotiation. Overrides LanguageNegotiationMethodInterface::getLangcode
LanguageNegotiationSelected::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.