You are here

public function ClusterManager::loadAllClusters in Elasticsearch Connector 8.6

Same name and namespace in other branches
  1. 8.7 src/ClusterManager.php \Drupal\elasticsearch_connector\ClusterManager::loadAllClusters()
  2. 8.5 src/ClusterManager.php \Drupal\elasticsearch_connector\ClusterManager::loadAllClusters()

Load all clusters.

Parameters

bool $include_inactive:

Return value

\Drupal\elasticsearch_connector\Entity\Cluster[]

File

src/ClusterManager.php, line 69

Class

ClusterManager
ClusterManager service.

Namespace

Drupal\elasticsearch_connector

Code

public function loadAllClusters($include_inactive = TRUE) {
  $clusters = $this->entityTypeManager
    ->getStorage('elasticsearch_cluster')
    ->loadMultiple();
  foreach ($clusters as $cluster) {
    if (!$include_inactive && !$cluster->status) {
      unset($clusters[$cluster->cluster_id]);
    }
  }
  return $clusters;
}