public function ClusterListBuilder::group in Elasticsearch Connector 8.2
Same name and namespace in other branches
- 8.7 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::group()
- 8.5 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::group()
- 8.6 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::group()
1 call to ClusterListBuilder::group()
- ClusterListBuilder::render in src/
Controller/ ClusterListBuilder.php - Builds the entity listing as renderable array for table.html.twig.
File
- src/
Controller/ ClusterListBuilder.php, line 69 - Contains \Drupal\elasticsearch_connector\Controller\ClusterListBuilder.
Class
- ClusterListBuilder
- Provides a listing of Clusters along with their indices.
Namespace
Drupal\elasticsearch_connector\ControllerCode
public function group() {
/** @var Cluster[] $clusters */
$clusters = $this->storage
->loadMultiple();
/** @var Index[] $indices */
$indices = $this->indexStorage
->loadMultiple();
$cluster_groups = array();
$lone_indices = array();
foreach ($clusters as $cluster) {
$cluster_group = array(
'cluster.' . $cluster->cluster_id => $cluster,
);
foreach ($indices as $index) {
if ($index->server == $cluster->cluster_id) {
$cluster_group['index.' . $index->index_id] = $index;
}
elseif ($index->server == NULL) {
$lone_indices['index.' . $index->index_id] = $index;
}
}
$cluster_groups['cluster.' . $cluster->cluster_id] = $cluster_group;
}
return array(
'clusters' => $cluster_groups,
'lone_indexes' => $lone_indices,
);
}