You are here

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

Form submit handler - opens the edit form for an existing item.

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 1049

Class

EntityReferenceLayoutWidget
Entity Reference with Layout field widget.

Namespace

Drupal\entity_reference_layout\Plugin\Field\FieldWidget

Code

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