You are here

public function ClusterListBuilder::getDefaultOperations in Elasticsearch Connector 8

Same name and namespace in other branches
  1. 8.7 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 159
Contains \Drupal\elasticsearch_connector\Controller\ClusterListBuilder.

Class

ClusterListBuilder
Provides a listing of Clusters along with their indices.

Namespace

Drupal\elasticsearch_connector\Controller

Code

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