public static function WebformElementStates::ajaxCallback in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Element/WebformElementStates.php \Drupal\webform\Element\WebformElementStates::ajaxCallback()
Webform submission Ajax callback the returns the states table.
File
- src/
Element/ WebformElementStates.php, line 716
Class
- WebformElementStates
- Provides a webform element to edit an element's #states.
Namespace
Drupal\webform\ElementCode
public static function ajaxCallback(array &$form, FormStateInterface $form_state) {
$button = $form_state
->getTriggeringElement();
$parent_length = isset($button['#row_index']) ? -4 : -2;
$element = NestedArray::getValue($form, array_slice($button['#array_parents'], 0, $parent_length));
return $element;
}