You are here

public function LayoutParagraphsWidget::removeItemCancelSubmit in Layout Paragraphs 1.0.x

Form submit handler - cancels item removal and closes confirmation form.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

src/Plugin/Field/FieldWidget/LayoutParagraphsWidget.php, line 1605

Class

LayoutParagraphsWidget
Entity Reference with Layout field widget.

Namespace

Drupal\layout_paragraphs\Plugin\Field\FieldWidget

Code

public function removeItemCancelSubmit(array $form, FormStateInterface $form_state) {
  $element = $form_state
    ->getTriggeringElement();
  $parents = $element['#element_parents'];
  $widget_state = static::getWidgetState($parents, $this->fieldName, $form_state);
  $widget_state['remove_item'] = FALSE;
  static::setWidgetState($parents, $this->fieldName, $form_state, $widget_state);
  $form_state
    ->setRebuild();
}