public function BasicAuthSolrConnector::submitConfigurationForm in Search API Solr 8
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 SolrConnectorPluginBase::submitConfigurationForm
File
- src/
Plugin/ SolrConnector/ BasicAuthSolrConnector.php, line 64
Class
- BasicAuthSolrConnector
- Standard Solr connector.
Namespace
Drupal\search_api_solr\Plugin\SolrConnectorCode
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.)
$values += $values['auth'];
// For password fields, there is no default value, they're empty by default.
// Therefore we ignore empty submissions if the user didn't change either.
if ($values['password'] === '' && isset($this->configuration['username']) && $values['username'] === $this->configuration['username']) {
$values['password'] = $this->configuration['password'];
}
foreach ($values['auth'] as $key => $value) {
$form_state
->setValue($key, $value);
}
// Clean-up the form to avoid redundant entries in the stored configuration.
$form_state
->unsetValue('auth');
parent::submitConfigurationForm($form, $form_state);
}