Skip to content
Snippets Groups Projects
Commit 0947b0fb authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2246657 by tstoeckler, YesCT: $options is misnamed in...

Issue #2246657 by tstoeckler, YesCT: $options is misnamed in Language::__construct() should be property values.
parent 70ce81aa
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -91,22 +91,23 @@ class Language implements LanguageInterface {
/**
* Constructs a new class instance.
*
* @param array $options
* The properties used to construct the language.
* @param array $values
* An array of property values, keyed by property name, used to construct
* the language.
*/
public function __construct(array $options = array()) {
public function __construct(array $values = array()) {
// Set all the provided properties for the language.
foreach ($options as $name => $value) {
$this->{$name} = $value;
foreach ($values as $key => $value) {
$this->{$key} = $value;
}
// If some options were not set, set sane defaults of a predefined language.
if (!isset($options['name']) || !isset($options['direction'])) {
// 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($options['name'])) {
if (!isset($values['name'])) {
$this->name = $predefined[$this->id][0];
}
if (!isset($options['direction']) && isset($predefined[$this->id][2])) {
if (!isset($values['direction']) && isset($predefined[$this->id][2])) {
$this->direction = $predefined[$this->id][2];
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment