public function BasicAuthTrait::submitConfigurationForm in Search API Solr 4.x
Same name and namespace in other branches
- 8.3 src/SolrConnector/BasicAuthTrait.php \Drupal\search_api_solr\SolrConnector\BasicAuthTrait::submitConfigurationForm()
- 8.2 src/SolrConnector/BasicAuthTrait.php \Drupal\search_api_solr\SolrConnector\BasicAuthTrait::submitConfigurationForm()
File
- src/
SolrConnector/ BasicAuthTrait.php, line 60
Class
- BasicAuthTrait
- Basic auth functionality for a Solr connector.
Namespace
Drupal\search_api_solr\SolrConnectorCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
foreach ($values['auth'] as $key => $value) {
// 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 ('password' === $key && '' === $value && isset($this->configuration['auth']['username']) && $values['auth']['username'] === $this->configuration['auth']['username']) {
$value = $form_state
->get('previous_password');
}
$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);
}