You are here

public static function YamlFormMultiple::ajaxCallback in YAML Form 8

Form submission AJAX callback the returns the list table.

File

src/Element/YamlFormMultiple.php, line 396

Class

YamlFormMultiple
Provides a form element to assist in creation of multiple elements.

Namespace

Drupal\yamlform\Element

Code

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['items'];
}