Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LanguageNegotiationUI.php

class LanguageNegotiationUI

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

Hierarchy

  • class \Drupal\language\LanguageNegotiationMethodBase implements \Drupal\language\LanguageNegotiationMethodInterface
    • class \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI extends \Drupal\language\LanguageNegotiationMethodBase

Expanded class hierarchy of LanguageNegotiationUI

2 files declare their use of LanguageNegotiationUI
LanguageHooks.php in core/modules/language/src/Hook/LanguageHooks.php
LanguageNegotiator.php in core/modules/language/src/LanguageNegotiator.php

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.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal