You are here

public function Simple::getQueueListBuilderOperations in Entityqueue 8

Gets this queue handler's list builder operations.

Return value

array An array of entity operations, as defined by \Drupal\Core\Entity\EntityListBuilderInterface::getOperations()

Overrides EntityQueueHandlerBase::getQueueListBuilderOperations

File

src/Plugin/EntityQueueHandler/Simple.php, line 93

Class

Simple
Defines an entity queue handler that manages a single subqueue.

Namespace

Drupal\entityqueue\Plugin\EntityQueueHandler

Code

public function getQueueListBuilderOperations() {

  // Simple queues have just one subqueue so we can link directly to the edit
  // form.
  $subqueue = EntitySubqueue::load($this->queue
    ->id());
  $subqueue = $this->entityRepository
    ->getTranslationFromContext($subqueue);
  $operations['edit_subqueue'] = [
    'title' => $this
      ->t('Edit items'),
    'weight' => -9,
    'url' => $subqueue
      ->toUrl('edit-form')
      ->mergeOptions([
      'query' => $this
        ->getRedirectDestination()
        ->getAsArray(),
    ]),
  ];

  // Add a 'Translate' operation if translation is enabled for this queue.
  if ($this->moduleHandler
    ->moduleExists('content_translation') && content_translation_translate_access($subqueue)
    ->isAllowed()) {
    $operations['translate_subqueue'] = [
      'title' => $this
        ->t('Translate subqueue'),
      'url' => $subqueue
        ->toUrl('drupal:content-translation-overview'),
      'weight' => -8,
    ];
  }
  return $operations;
}