You are here

public function PatternDefinition::getVariantsAsOptions in UI Patterns 8

Get field as options.

Return value

array Variants as select options.

File

src/Definition/PatternDefinition.php, line 256

Class

PatternDefinition
Class PatternDefinition.

Namespace

Drupal\ui_patterns\Definition

Code

public function getVariantsAsOptions() {
  $options = [];
  foreach ($this
    ->getVariants() as $field) {
    $options[$field
      ->getName()] = $field
      ->getLabel();
  }
  return $options;
}