public static function WebformMultiple::ajaxCallback in Webform 8.5
Same name and namespace in other branches
- 6.x src/Element/WebformMultiple.php \Drupal\webform\Element\WebformMultiple::ajaxCallback()
Webform submission Ajax callback the returns the list table.
File
- src/
Element/ WebformMultiple.php, line 897
Class
- WebformMultiple
- Provides a webform element to assist in creation of multiple elements.
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));
// Make sure only the ajax prefix and suffix is used.
$element['#prefix'] = $element['#ajax_prefix'];
$element['#suffix'] = $element['#ajax_suffix'];
// Disable states and flexbox wrapper.
// @see \Drupal\webform\Plugin\WebformElementBase::preRenderFixFlexboxWrapper
$element['#webform_wrapper'] = FALSE;
return $element;
}