You are here

public function SolrConnectorPluginBase::submitConfigurationForm in Search API Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::submitConfigurationForm()
  2. 8 src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::submitConfigurationForm()
  3. 4.x src/SolrConnector/SolrConnectorPluginBase.php \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::submitConfigurationForm

File

src/SolrConnector/SolrConnectorPluginBase.php, line 276

Class

SolrConnectorPluginBase
Defines a base class for Solr connector plugins.

Namespace

Drupal\search_api_solr\SolrConnector

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();

  // Since the form is nested into another, we can't simply use #parents for
  // doing this array restructuring magic. (At least not without creating an
  // unnecessary dependency on internal implementation.)
  foreach ($values['workarounds'] as $key => $value) {
    $form_state
      ->setValue($key, $value);
  }
  foreach ($values['advanced'] as $key => $value) {
    $form_state
      ->setValue($key, $value);
  }

  // Clean-up the form to avoid redundant entries in the stored configuration.
  $form_state
    ->unsetValue('workarounds');
  $form_state
    ->unsetValue('advanced');
  $this
    ->traitSubmitConfigurationForm($form, $form_state);
}