You are here

protected static function WebformElementStates::getStatesArrayCondition in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformElementStates.php \Drupal\webform\Element\WebformElementStates::getStatesArrayCondition()

Get states array condition.

Parameters

string $selector: The selector.

array $condition: The condition.

Return value

array Associative array container selector, trigger, and value.

1 call to WebformElementStates::getStatesArrayCondition()
WebformElementStates::convertFormApiStatesToStatesArray in src/Element/WebformElementStates.php
Convert Form API #states to states array.

File

src/Element/WebformElementStates.php, line 814

Class

WebformElementStates
Provides a webform element to edit an element's #states.

Namespace

Drupal\webform\Element

Code

protected static function getStatesArrayCondition($selector, array $condition) {
  $trigger = key($condition);
  $value = reset($condition);
  if (is_array($value)) {
    return static::getStatesArrayCondition($selector, $value);
  }
  return [
    'selector' => $selector,
    'trigger' => $trigger,
    'value' => $value,
  ];
}