public function ClusterListBuilder::buildRow in Elasticsearch Connector 8
Same name and namespace in other branches
- 8.7 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::buildRow()
- 8.2 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::buildRow()
- 8.5 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::buildRow()
- 8.6 src/Controller/ClusterListBuilder.php \Drupal\elasticsearch_connector\Controller\ClusterListBuilder::buildRow()
Builds a row for an entity in the entity listing.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
Return value
array A render array structure of fields for this entity.
Overrides EntityListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
1 call to ClusterListBuilder::buildRow()
- ClusterListBuilder::render in src/
Controller/ ClusterListBuilder.php - Builds the entity listing as renderable array for table.html.twig.
File
- src/
Controller/ ClusterListBuilder.php, line 91 - Contains \Drupal\elasticsearch_connector\Controller\ClusterListBuilder.
Class
- ClusterListBuilder
- Provides a listing of Clusters along with their indices.
Namespace
Drupal\elasticsearch_connector\ControllerCode
public function buildRow(EntityInterface $entity) {
$row = parent::buildRow($entity);
$result = array();
$status = NULL;
if (isset($entity->cluster_id)) {
$cluster = Cluster::load($entity->cluster_id);
$client_info = $cluster
->getClusterInfo();
if (!empty($client_info['health']) && $cluster
->checkClusterStatus()) {
$status = $client_info['health']['status'];
}
else {
$status = t('Not available');
}
$result = array(
'data' => array(
'type' => array(
'data' => $this
->t('Cluster'),
),
'title' => array(
'data' => array(
'#type' => 'link',
'#title' => $entity
->label(),
) + $entity
->urlInfo('canonical')
->toRenderArray(),
),
'machine_name' => array(
'data' => $entity
->id(),
),
'status' => array(
'data' => $cluster->status ? 'Active' : 'Inactive',
),
'clusterStatus' => array(
'data' => $status,
),
'operations' => $row['operations'],
),
'title' => $this
->t('Machine name: @name', array(
'@name' => $entity
->id(),
)),
);
}
elseif (isset($entity->index_id)) {
$result = array(
'data' => array(
'type' => array(
'data' => $this
->t('Index'),
),
'title' => array(
'data' => $entity
->label(),
),
'machine_name' => array(
'data' => $entity
->id(),
),
'status' => array(
'data' => '',
),
'clusterStatus' => array(
'data' => '-',
),
'operations' => $row['operations'],
),
'title' => $this
->t('Machine name: @name', array(
'@name' => $entity
->id(),
)),
);
}
return $result;
}