You are here

class LanguageDefault in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Language/LanguageDefault.php \Drupal\Core\Language\LanguageDefault

Provides a simple get and set wrapper to the default language object.

The default language must be provided without dependencies since it is both configured and a dependency of the configuration system. The LanguageDefault object is a container service. The default values are stored on the container by \Drupal\Core\DrupalKernel::buildContainer(). This allows services to override this parameter in a ServiceProvider, for example, \Drupal\language\LanguageServiceProvider::alter().

Hierarchy

Expanded class hierarchy of LanguageDefault

5 files declare their use of LanguageDefault
ConfigSubscriber.php in core/modules/language/src/EventSubscriber/ConfigSubscriber.php
Contains \Drupal\language\EventSubscriber\ConfigSubscriber.
ConfigurableLanguageManager.php in core/modules/language/src/ConfigurableLanguageManager.php
Contains \Drupal\language\ConfigurableLanguageManager.
LanguageConfigFactoryOverride.php in core/modules/language/src/Config/LanguageConfigFactoryOverride.php
Contains \Drupal\language\Config\LanguageConfigFactoryOverride.
LanguageConfigFactoryOverrideInterface.php in core/modules/language/src/Config/LanguageConfigFactoryOverrideInterface.php
Contains \Drupal\language\Config\LanguageConfigFactoryOverrideInterface.
TranslationManager.php in core/lib/Drupal/Core/StringTranslation/TranslationManager.php
Contains \Drupal\Core\StringTranslation\TranslationManager.
1 string reference to 'LanguageDefault'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses LanguageDefault
language.default in core/core.services.yml
Drupal\Core\Language\LanguageDefault

File

core/lib/Drupal/Core/Language/LanguageDefault.php, line 20
Contains \Drupal\Core\Language\LanguageDefault.

Namespace

Drupal\Core\Language
View source
class LanguageDefault {

  /**
   * The default language.
   *
   * @var \Drupal\Core\Language\LanguageInterface
   */
  protected $language;

  /**
   * Constructs the default language object.
   *
   * @param array $values
   *   The properties used to construct the default language.
   */
  public function __construct(array $values) {
    $this
      ->set(new Language($values));
  }

  /**
   * Gets the default language.
   *
   * @return \Drupal\Core\Language\LanguageInterface
   *   The default language.
   */
  public function get() {
    return $this->language;
  }

  /**
   * Sets the default language.
   *
   * @param \Drupal\Core\Language\LanguageInterface $language
   *   The default language.
   */
  public function set(LanguageInterface $language) {
    $this->language = $language;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LanguageDefault::$language protected property The default language.
LanguageDefault::get public function Gets the default language.
LanguageDefault::set public function Sets the default language.
LanguageDefault::__construct public function Constructs the default language object.