You are here

public function ElasticsearchController::page in Elasticsearch Connector 8.6

Same name and namespace in other branches
  1. 8.7 src/Controller/ElasticsearchController.php \Drupal\elasticsearch_connector\Controller\ElasticsearchController::page()
  2. 8 src/Controller/ElasticsearchController.php \Drupal\elasticsearch_connector\Controller\ElasticsearchController::page()
  3. 8.2 src/Controller/ElasticsearchController.php \Drupal\elasticsearch_connector\Controller\ElasticsearchController::page()
  4. 8.5 src/Controller/ElasticsearchController.php \Drupal\elasticsearch_connector\Controller\ElasticsearchController::page()

Displays information about an Elasticsearch Cluster.

Parameters

\Drupal\elasticsearch_connector\Entity\Cluster $elasticsearch_cluster: An instance of Cluster.

Return value

array An array suitable for drupal_render().

File

src/Controller/ElasticsearchController.php, line 50

Class

ElasticsearchController
Provides route responses for elasticsearch clusters.

Namespace

Drupal\elasticsearch_connector\Controller

Code

public function page(Cluster $elasticsearch_cluster) {

  // Build the Search API index information.
  $render = [
    'view' => [
      '#theme' => 'elasticsearch_cluster',
      '#cluster' => $elasticsearch_cluster,
    ],
  ];

  // Check if the cluster is enabled and can be written to.
  if ($elasticsearch_cluster->cluster_id) {
    $render['form'] = $this
      ->formBuilder()
      ->getForm('Drupal\\elasticsearch_connector\\Form\\ClusterForm', $elasticsearch_cluster);
  }
  return $render;
}