You are here

public function IndexController::page in Search API 8

Displays information about a search index.

Parameters

\Drupal\search_api\IndexInterface $search_api_index: The index to display.

Return value

array An array suitable for drupal_render().

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

File

src/Controller/IndexController.php, line 114

Class

IndexController
Provides route responses for search indexes.

Namespace

Drupal\search_api\Controller

Code

public function page(IndexInterface $search_api_index) {

  // Build the search index information.
  $render = [
    'view' => [
      '#theme' => 'search_api_index',
      '#index' => $search_api_index,
    ],
  ];

  // Check if the index is enabled and can be written to.
  if ($search_api_index
    ->status() && !$search_api_index
    ->isReadOnly()) {

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