/** * {@inheritdoc} */ public function submitOptionsForm(&$form, FormStateInterface $form_state) { parent::submitOptionsForm($form, $form_state); $subform = $form['entity_reference_selection']; $subform_state = new ViewsHandlerFormState($form_state); $entity_reference_selection_selector = $this->getPluginSelector($form_state); $entity_reference_selection_selector->submitSelectorForm($subform, $subform_state); // Views magically sets all submitted form values as plugin options. We must // therefore unset any values submitted by the entity reference selection // plugin form, and add the ID and configuration of the selected plugin. $entity_reference_selection = $entity_reference_selection_selector->getSelectedPlugin(); $form_state->setValue(['options', 'entity_reference_selection_id'], $entity_reference_selection->getPluginId()); $entity_reference_selection_handler_settings = $form_state->getValue(['options', 'entity_reference_selection', 'container', 'plugin_form']); $form_state->setValue(['options', 'entity_reference_selection_handler_settings'], $entity_reference_selection_handler_settings); $form_state->unsetValue(['options', 'entity_reference_selection']); }