You are here

public static function ShsTermSelect::setOptions in Webform Simple Hierarchical Select 8

Same name in this branch
  1. 8 src/Element/ShsTermSelect.php \Drupal\webform_shs\Element\ShsTermSelect::setOptions()
  2. 8 src/Plugin/WebformElement/ShsTermSelect.php \Drupal\webform_shs\Plugin\WebformElement\ShsTermSelect::setOptions()
2 calls to ShsTermSelect::setOptions()
ShsTermSelect::processSelect in src/Element/ShsTermSelect.php
Processes a select list form element.
ShsTermSelect::setOptions in src/Plugin/WebformElement/ShsTermSelect.php
Get element options.

File

src/Element/ShsTermSelect.php, line 157

Class

ShsTermSelect
Provides a webform element for an shs term select menu.

Namespace

Drupal\webform_shs\Element

Code

public static function setOptions(array &$element) {
  if (!empty($element['#options'])) {
    return;
  }
  if (!\Drupal::moduleHandler()
    ->moduleExists('taxonomy') || empty($element['#vocabulary'])) {
    $element['#options'] = [];
    return;
  }
  $element['#options'] = static::getOptions($element);
}