You are here

public function EntitySubqueueListBuilder::getDefaultOperations in Entityqueue 8

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 EntityListBuilder::getDefaultOperations

File

src/EntitySubqueueListBuilder.php, line 109

Class

EntitySubqueueListBuilder
Defines a class that builds a listing of entity subqueues.

Namespace

Drupal\entityqueue

Code

public function getDefaultOperations(EntityInterface $entity) {
  $operations = parent::getDefaultOperations($entity);
  $operations['edit']['title'] = $this
    ->t('Edit items');

  /** @var \Drupal\entityqueue\EntityQueueInterface $queue */
  $queue = $entity
    ->getQueue();

  // Add the 'edit queue' operation as well.
  if ($queue
    ->access('update') && $queue
    ->hasLinkTemplate('edit-form')) {
    $operations['configure'] = [
      'title' => $this
        ->t('Configure queue'),
      'weight' => 10,
      'url' => $this
        ->ensureDestination($queue
        ->toUrl('edit-form')),
    ];
  }
  return $operations;
}