You are here

protected function IndexForm::getServerOptions in Search API 8

Retrieves all available servers as an options list.

Return value

string[] An associative array mapping server IDs to their labels.

1 call to IndexForm::getServerOptions()
IndexForm::buildEntityForm in src/Form/IndexForm.php
Builds the form for the basic index properties.

File

src/Form/IndexForm.php, line 91

Class

IndexForm
Provides a form for the Index entity.

Namespace

Drupal\search_api\Form

Code

protected function getServerOptions() {
  $options = [];

  /** @var \Drupal\search_api\ServerInterface[] $servers */
  $servers = $this->entityTypeManager
    ->getStorage('search_api_server')
    ->loadMultiple();
  foreach ($servers as $server_id => $server) {

    // @todo Special formatting for disabled servers.
    $options[$server_id] = Utility::escapeHtml($server
      ->label());
  }
  return $options;
}