"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/Language/LanguageDefault.php" (26 Nov 2020, 1362 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "LanguageDefault.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\Language;
    4 
    5 /**
    6  * Provides a simple get and set wrapper to the default language object.
    7  *
    8  * The default language must be provided without dependencies since it is both
    9  * configured and a dependency of the configuration system. The LanguageDefault
   10  * object is a container service. The default values are stored on the container
   11  * by \Drupal\Core\DrupalKernel::buildContainer(). This allows services to
   12  * override this parameter in a ServiceProvider, for example,
   13  * \Drupal\language\LanguageServiceProvider::alter().
   14  */
   15 class LanguageDefault {
   16 
   17   /**
   18    * The default language.
   19    *
   20    * @var \Drupal\Core\Language\LanguageInterface
   21    */
   22   protected $language;
   23 
   24   /**
   25    * Constructs the default language object.
   26    *
   27    * @param array $values
   28    *   The properties used to construct the default language.
   29    */
   30   public function __construct(array $values) {
   31     $this->set(new Language($values));
   32   }
   33 
   34   /**
   35    * Gets the default language.
   36    *
   37    * @return \Drupal\Core\Language\LanguageInterface
   38    *   The default language.
   39    */
   40   public function get() {
   41     return $this->language;
   42   }
   43 
   44   /**
   45    * Sets the default language.
   46    *
   47    * @param \Drupal\Core\Language\LanguageInterface $language
   48    *   The default language.
   49    */
   50   public function set(LanguageInterface $language) {
   51     $this->language = $language;
   52   }
   53 
   54 }