public function SearchApiSolrBackend::submitConfigurationForm in Search API Solr 8.3
Same name and namespace in other branches
- 8 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::submitConfigurationForm()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::submitConfigurationForm()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::submitConfigurationForm()
Throws
\Drupal\Component\Plugin\Exception\PluginException
\Drupal\search_api\SearchApiException
Overrides PluginFormInterface::submitConfigurationForm
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 510
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['connector'] = $form_state
->get('connector');
$connector = $this
->getSolrConnector();
if ($connector instanceof PluginFormInterface) {
$connector_form_state = SubformState::createForSubform($form['connector_config'], $form, $form_state);
$connector
->submitConfigurationForm($form['connector_config'], $connector_form_state);
// Overwrite the form values with type casted values.
// @see \Drupal\search_api_solr\SolrConnector\SolrConnectorPluginBase::setConfiguration()
$form_state
->setValue('connector_config', $connector
->getConfiguration());
}
$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['advanced'];
$values += $values['multisite'];
$values['optimize'] &= $values['i_know_what_i_do'];
foreach ($values as $key => $value) {
$form_state
->setValue($key, $value);
}
// Clean-up the form to avoid redundant entries in the stored configuration.
$form_state
->unsetValue('advanced');
$form_state
->unsetValue('multisite');
// The server description is a #type item element, which means it has a
// value, do not save it.
$form_state
->unsetValue('server_description');
$form_state
->unsetValue('i_know_what_i_do');
$this
->traitSubmitConfigurationForm($form, $form_state);
// Delete cached endpoint data.
\Drupal::state()
->delete('search_api_solr.endpoint.data');
}