You are here

public static function ModuleBuilderComponentFormBase::addItemSubmit in Module Builder 7.2

Submission handler for the "Add another item" buttons.

1 call to ModuleBuilderComponentFormBase::addItemSubmit()
mb_addItemSubmit in includes/module_builder.pages.inc

File

includes/module_builder.form.inc, line 527

Class

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

Code

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

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

  // Increment the item count for this element.
  $property_address = $element['#mb_value_address'];
  static::incrementCompoundPropertyItemCount($form_state, $property_address);
  $form_state
    ->setRebuild();
}