You are here

public function ClusterListBuilder::getDefaultOperations in Elasticsearch Connector 8.7

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

Gets this list's default operations.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array The array structure is identical to the return value of self::getOperations().

Overrides ConfigEntityListBuilder::getDefaultOperations

File

src/Controller/ClusterListBuilder.php, line 221

Class

ClusterListBuilder
Provides a listing of Clusters along with their indices.

Namespace

Drupal\elasticsearch_connector\Controller

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = [];
  if (isset($entity->cluster_id)) {
    $operations['info'] = [
      'title' => $this
        ->t('Info'),
      'weight' => 19,
      'url' => new Url('entity.elasticsearch_cluster.canonical', [
        'elasticsearch_cluster' => $entity
          ->id(),
      ]),
    ];
    $operations['edit'] = [
      'title' => $this
        ->t('Edit'),
      'weight' => 20,
      'url' => new Url('entity.elasticsearch_cluster.edit_form', [
        'elasticsearch_cluster' => $entity
          ->id(),
      ]),
    ];
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'weight' => 21,
      'url' => new Url('entity.elasticsearch_cluster.delete_form', [
        'elasticsearch_cluster' => $entity
          ->id(),
      ]),
    ];
  }
  elseif (isset($entity->index_id)) {
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'weight' => 20,
      'url' => new Url('entity.elasticsearch_index.delete_form', [
        'elasticsearch_index' => $entity
          ->id(),
      ]),
    ];
  }
  return $operations;
}