You are here

public static function ParagraphsWidget::paragraphsItemSubmit in Paragraphs 8

File

src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 1864

Class

ParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\paragraphs\Plugin\Field\FieldWidget

Code

public static function paragraphsItemSubmit(array $form, FormStateInterface $form_state) {
  $submit = ParagraphsWidget::getSubmitElementInfo($form, $form_state, ParagraphsWidget::ACTION_POSITION_ACTIONS);
  $new_mode = $submit['button']['#paragraphs_mode'];
  if ($new_mode === 'edit') {
    $submit['widget_state'] = static::autocollapse($submit['widget_state']);
  }
  $submit['widget_state']['paragraphs'][$submit['delta']]['mode'] = $new_mode;
  if (!empty($submit['button']['#paragraphs_show_warning'])) {
    $submit['widget_state']['paragraphs'][$submit['delta']]['show_warning'] = $submit['button']['#paragraphs_show_warning'];
  }
  static::setWidgetState($submit['parents'], $submit['field_name'], $form_state, $submit['widget_state']);
  $form_state
    ->setRebuild();
}