You are here

public static function ComponentSectionForm::complexButtonAjax in Module Builder 8.3

File

src/Form/ComponentSectionForm.php, line 708

Class

ComponentSectionForm
Generic form for entering a section of data for a component.

Namespace

Drupal\module_builder\Form

Code

public static function complexButtonAjax(array $form, FormStateInterface $form_state) {
  $button = $form_state
    ->getTriggeringElement();

  // Go up in the form, to the widgets container.
  $button_array_parents = $button['#array_parents'];
  $widgets_container_parents = array_slice($button_array_parents, 0, -1);
  $element = NestedArray::getValue($form, $widgets_container_parents);
  return $element;
}