function 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 361

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'];
  // Ensure that only the select sub handler option is saved.
  foreach (array_keys($this->getSubHandlerOptions()) as $sub_handler_option) {
    if ($sub_handler_option == $sub_handler) {
      $this->options['sub_handler_settings'] = $this->options[static::SUBFORM_PREFIX . $sub_handler_option];
    }
    if (isset($this->options[static::SUBFORM_PREFIX . $sub_handler_option])) {
      unset($this->options[static::SUBFORM_PREFIX . $sub_handler_option]);
    }
  }
}

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