You are here

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\Definition

Code

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;
  }
}