You are here

public static function ComponentSectionForm::itemButtonAjax in Module Builder 8.3

Ajax callback for the item count buttons.

This returns the new page content to replace the page content made obsolete by the form submission.

File

src/Form/ComponentSectionForm.php, line 669

Class

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

Namespace

Drupal\module_builder\Form

Code

public static function itemButtonAjax(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;
}