You are here

public static function ModuleBuilderComponentFormBase::removeItemSubmit in Module Builder 7.2

Submission handler for the "Remove item" buttons.

1 call to ModuleBuilderComponentFormBase::removeItemSubmit()
mb_removeItemSubmit in includes/module_builder.pages.inc

File

includes/module_builder.form.inc, line 543

Class

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

Code

public static function removeItemSubmit(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::decrementCompoundPropertyItemCount($form_state, $property_address);
  $form_state
    ->setRebuild();
}