You are here

public static function ModuleBuilderComponentFormBase::itemButtonAjax in Module Builder 7.2

Ajax callback for the item count buttons.

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

1 call to ModuleBuilderComponentFormBase::itemButtonAjax()
mb_itemButtonAjax in includes/module_builder.pages.inc

File

includes/module_builder.form.inc, line 562

Class

ModuleBuilderComponentFormBase
Backport of ComponentFormBase from 8.x-3.x version.

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, -2);
  $element = NestedArray::getValue($form, $widgets_container_parents);
  return $element;
}