function EntityReference::submitExtraOptionsForm

Same name and namespace in other branches
  1. main core/modules/views/src/Plugin/views/filter/EntityReference.php \Drupal\views\Plugin\views\filter\EntityReference::submitExtraOptionsForm()

Perform any necessary changes to the form values prior to storage.

There is no need for this function to actually store the data.

Parameters

array $form: Associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides HandlerBase::submitExtraOptionsForm

File

core/modules/views/src/Plugin/views/filter/EntityReference.php, line 346

Class

EntityReference
Filters a view by entity references.

Namespace

Drupal\views\Plugin\views\filter

Code

public function submitExtraOptionsForm($form, FormStateInterface $form_state) : void {
  $sub_handler = $form_state->getValue('options')['sub_handler'];
  // Unset sub handler settings that are not selected so they are not saved.
  // ConfigHandlerExtra::submitForm will set the selected sub handler's
  // settings.
  foreach (array_keys($this->getSubHandlerOptions()) as $sub_handler_option) {
    $subform_key = static::SUBFORM_PREFIX . $sub_handler_option;
    if ($sub_handler_option !== $sub_handler && isset($this->options[$subform_key])) {
      unset($this->options[$subform_key]);
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.