public function PatternDefinitionVariant::__construct in UI Patterns 8
PatternDefinitionVariant constructor.
File
- src/
Definition/ PatternDefinitionVariant.php, line 28
Class
- PatternDefinitionVariant
- Class PatternDefinitionVariant.
Namespace
Drupal\ui_patterns\DefinitionCode
public function __construct($name, $value) {
if (is_scalar($value)) {
$this->definition['name'] = is_numeric($name) ? $value : $name;
$this->definition['label'] = $value;
}
else {
$this->definition['name'] = !isset($value['name']) ? $name : $value['name'];
$this->definition['label'] = $value['label'];
$this->definition = $value + $this->definition;
}
}