You are here

public function ElasticsearchController::page in Elasticsearch Connector 8

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

Displays information about an Elasticsearch Cluster.

Parameters

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

Return value

array An array suitable for drupal_render().

File

src/Controller/ElasticsearchController.php, line 29
Contains \Drupal\elasticsearch_connector\Controller\ElasticsearchController.

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 = array(
    'view' => array(
      '#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;
}