public function SearchApiSolrBackend::buildConnectorConfigForm in Search API Solr 8
Same name and namespace in other branches
- 8.3 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
\Drupal\search_api_solr\SolrConnectorInterface $connector: The server that is being created or edited.
1 call to SearchApiSolrBackend::buildConnectorConfigForm()
- SearchApiSolrBackend::buildConfigurationForm in src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php - Form constructor.
File
- src/
Plugin/ search_api/ backend/ SearchApiSolrBackend.php, line 317
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()) {
$this
->messenger()
->addWarning('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', array(
'%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;
}