class LanguageNegotiationMethodBase

Same name and namespace in other branches
  1. 10 core/modules/language/src/LanguageNegotiationMethodBase.php \Drupal\language\LanguageNegotiationMethodBase
  2. 11.x core/modules/language/src/LanguageNegotiationMethodBase.php \Drupal\language\LanguageNegotiationMethodBase
  3. 9 core/modules/language/src/LanguageNegotiationMethodBase.php \Drupal\language\LanguageNegotiationMethodBase

Base class for language negotiation methods.

Hierarchy

Expanded class hierarchy of LanguageNegotiationMethodBase

10 files declare their use of LanguageNegotiationMethodBase
LanguageNegotiationBrowser.php in core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php
LanguageNegotiationContentEntity.php in core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationContentEntity.php
LanguageNegotiationSelected.php in core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php
LanguageNegotiationSession.php in core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSession.php
LanguageNegotiationTest.php in core/modules/language/tests/language_test/src/Plugin/LanguageNegotiation/LanguageNegotiationTest.php

... See full list

File

core/modules/language/src/LanguageNegotiationMethodBase.php, line 12

Namespace

Drupal\language
View source
abstract class LanguageNegotiationMethodBase implements LanguageNegotiationMethodInterface {
  
  /**
   * The language manager.
   *
   * @var \Drupal\Core\Language\LanguageManagerInterface
   */
  protected $languageManager;
  
  /**
   * The configuration factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $config;
  
  /**
   * The current active user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $currentUser;
  
  /**
   * {@inheritdoc}
   */
  public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager) {
    $this->languageManager = $language_manager;
  }
  
  /**
   * {@inheritdoc}
   */
  public function setConfig(ConfigFactoryInterface $config) {
    $this->config = $config;
  }
  
  /**
   * {@inheritdoc}
   */
  public function setCurrentUser(AccountInterface $current_user) {
    $this->currentUser = $current_user;
  }
  
  /**
   * {@inheritdoc}
   */
  public function persist(LanguageInterface $language) {
    // Default implementation persists nothing.
  }

}

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