You are here

public function EntityReferenceLayoutWidget::removeItemCancelSubmit in Entity Reference with Layout 8

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/EntityReferenceLayoutWidget.php, line 1114

Class

EntityReferenceLayoutWidget
Entity Reference with Layout field widget.

Namespace

Drupal\entity_reference_layout\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);
  unset($widget_state['remove_item']);
  static::setWidgetState($parents, $this->fieldName, $form_state, $widget_state);
  $form_state
    ->setRebuild();
}