public function ParagraphsWidget::extractFormValues

File

paragraphs/src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 2679

Class

ParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\paragraphs\Plugin\Field\FieldWidget

Code

public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) {

  // Filter possible empty items.
  $items
    ->filterEmptyItems();

  // Remove buttons from header actions.
  $field_name = $this->fieldDefinition
    ->getName();
  $path = array_merge($form['#parents'], array(
    $field_name,
  ));
  $form_state_variables = $form_state
    ->getValues();
  $key_exists = NULL;
  $values = NestedArray::getValue($form_state_variables, $path, $key_exists);
  if ($key_exists) {
    unset($values['header_actions']);
    NestedArray::setValue($form_state_variables, $path, $values);
    $form_state
      ->setValues($form_state_variables);
  }
  return parent::extractFormValues($items, $form, $form_state);
}