protected function IndexSolrMultisiteCloneForm::getServerOptions in Search API Solr 8.3
Same name and namespace in other branches
- 4.x src/Form/IndexSolrMultisiteCloneForm.php \Drupal\search_api_solr\Form\IndexSolrMultisiteCloneForm::getServerOptions()
Retrieves all available servers as an options list.
Return value
string[] An associative array mapping server IDs to their labels.
Throws
\Drupal\Component\Plugin\Exception\PluginNotFoundException
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\search_api\SearchApiException
Overrides IndexForm::getServerOptions
File
- src/
Form/ IndexSolrMultisiteCloneForm.php, line 117
Class
- IndexSolrMultisiteCloneForm
- Provides a form for the Index entity.
Namespace
Drupal\search_api_solr\FormCode
protected function getServerOptions() {
$options = [];
/** @var \Drupal\search_api\ServerInterface[] $servers */
$servers = $this->entityTypeManager
->getStorage('search_api_server')
->loadMultiple();
foreach ($servers as $server_id => $server) {
if ($server
->getBackend() instanceof SolrBackendInterface) {
// @todo Special formatting for disabled servers.
$options[$server_id] = SearchApiUtility::escapeHtml($server
->label());
}
}
return $options;
}