You are here

public function ServerController::page in Search API 8

Displays information about a search server.

Parameters

\Drupal\search_api\ServerInterface $search_api_server: The server to display.

Return value

array An array suitable for drupal_render().

1 string reference to 'ServerController::page'
search_api.routing.yml in ./search_api.routing.yml
search_api.routing.yml

File

src/Controller/ServerController.php, line 67

Class

ServerController
Provides block routines for search server-specific routes.

Namespace

Drupal\search_api\Controller

Code

public function page(ServerInterface $search_api_server) {

  // Build the search server information.
  $render = [
    'view' => [
      '#theme' => 'search_api_server',
      '#server' => $search_api_server,
    ],
    '#attached' => [
      'library' => [
        'search_api/drupal.search_api.admin_css',
      ],
    ],
  ];

  // Check if the server is enabled.
  if ($search_api_server
    ->status()) {

    // Attach the server status form.
    $render['form'] = $this
      ->formBuilder()
      ->getForm('Drupal\\search_api\\Form\\ServerStatusForm', $search_api_server);
  }
  return $render;
}