public function SearchApiSolrBackend::buildConnectorConfigForm 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::buildConnectorConfigForm()
- 8.2 src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::buildConnectorConfigForm()
- 4.x src/Plugin/search_api/backend/SearchApiSolrBackend.php \Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend::buildConnectorConfigForm()
Builds the backend-specific configuration form.
Parameters
array $form: The form array.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Throws
\Drupal\Component\Plugin\Exception\PluginException
1 call to SearchApiSolrBackend::buildConnectorConfigForm()
- SearchApiSolrBackend::buildConfigurationForm in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 429
Class
- SearchApiSolrBackend
- Apache Solr backend for search api.
Namespace
Drupal\search_api_solr\Plugin\search_api\backendCode
public function buildConnectorConfigForm(array &$form, FormStateInterface $form_state) {
$form['connector_config'] = [];
$connector_id = $this->configuration['connector'];
if ($connector_id) {
$connector = $this->solrConnectorPluginManager
->createInstance($connector_id, $this->configuration['connector_config']);
if ($connector instanceof PluginFormInterface) {
$form_state
->set('connector', $connector_id);
if ($form_state
->isRebuilding()) {
\Drupal::messenger()
->addWarning($this
->t('Please configure the selected Solr connector.'));
}
// Attach the Solr connector plugin configuration form.
$connector_form_state = SubformState::createForSubform($form['connector_config'], $form, $form_state);
$form['connector_config'] = $connector
->buildConfigurationForm($form['connector_config'], $connector_form_state);
// Modify the backend plugin configuration container element.
$form['connector_config']['#type'] = 'details';
$form['connector_config']['#title'] = $this
->t('Configure %plugin Solr connector', [
'%plugin' => $connector
->label(),
]);
$form['connector_config']['#description'] = $connector
->getDescription();
$form['connector_config']['#open'] = TRUE;
}
}
$form['connector_config'] += [
'#type' => 'container',
];
$form['connector_config']['#attributes'] = [
'id' => 'search-api-solr-connector-config-form',
];
$form['connector_config']['#tree'] = TRUE;
}