public Language::__construct(array$values= array())
Constructs a new class instance.
array $values: An array of property values, keyed by property name, used to construct the language.
public function __construct(array $values = array()) { // Set all the provided properties for the language. foreach ($values as $key => $value) { if (property_exists($this, $key)) { $this->{$key} = $value; } } // If some values were not set, set sane defaults of a predefined language. if (!isset($values['name']) || !isset($values['direction'])) { $predefined = LanguageManager::getStandardLanguageList(); if (isset($predefined[$this->id])) { if (!isset($values['name'])) { $this->name = $predefined[$this->id][0]; } if (!isset($values['direction']) && isset($predefined[$this->id][2])) { $this->direction = $predefined[$this->id][2]; } } } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Language!Language.php/function/Language::__construct/8.1.x