Sets the form mode accordingly.
array $form: An associate array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
public static function dragDropModeSubmit(array $form, FormStateInterface $form_state) {
$submit = ParagraphsWidget::getSubmitElementInfo($form, $form_state, ParagraphsWidget::ACTION_POSITION_HEADER);
if (empty($submit['widget_state']['dragdrop'])) {
$submit['widget_state']['dragdrop'] = TRUE;
}
else {
$submit['widget_state']['dragdrop'] = FALSE;
}
// Make sure that flag that we already reordered is unset when the mode is
// switched.
unset($submit['widget_state']['reordered']);
// Switch the form mode accordingly.
static::setWidgetState($submit['parents'], $submit['field_name'], $form_state, $submit['widget_state']);
$form_state
->setRebuild();
}