You are here

public function PatternDefinition::setVariants in UI Patterns 8

Setter.

Parameters

array $variants: Property value.

Return value

$this

1 call to PatternDefinition::setVariants()
PatternDefinition::__construct in src/Definition/PatternDefinition.php
PatternDefinition constructor.

File

src/Definition/PatternDefinition.php, line 272

Class

PatternDefinition
Class PatternDefinition.

Namespace

Drupal\ui_patterns\Definition

Code

public function setVariants(array $variants) {
  foreach ($variants as $name => $value) {
    $variant = $this
      ->getVariantDefinition($name, $value);
    $this->definition['variants'][$variant
      ->getName()] = $variant;
  }
  return $this;
}