You are here

public function EntityFormField::submitOptionsForm in Views Entity Form Field 8

Performs some cleanup tasks on the options array before saving it.

Overrides FieldPluginBase::submitOptionsForm

File

src/Plugin/views/field/EntityFormField.php, line 443

Class

EntityFormField
Defines a views form element for an entity field widget.

Namespace

Drupal\views_entity_form_field\Plugin\views\field

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  parent::submitOptionsForm($form, $form_state);
  $options =& $form_state
    ->getValue('options');
  $options['plugin']['settings'] = isset($options['plugin']['settings_edit_form']['settings']) ? array_intersect_key($options['plugin']['settings_edit_form']['settings'], $this->fieldWidgetManager
    ->getDefaultSettings($options['plugin']['type'])) : [];
  $options['plugin']['third_party_settings'] = isset($options['plugin']['settings_edit_form']['third_party_settings']) ? $options['plugin']['settings_edit_form']['third_party_settings'] : [];
  unset($options['plugin']['settings_edit_form']);
}