namespace Drupal\entityqueue;
+use Drupal\Core\Cache\Cache;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Session\AccountInterface;
use Drupal\entityqueue\Entity\EntitySubqueue;
use Symfony\Component\DependencyInjection\ContainerInterface;
*/
protected $entityTypeManager;
+ /**
+ * {@inheritdoc}
+ */
+ protected $limit = FALSE;
+
/**
* Constructs a new class instance.
*
* {@inheritdoc}
*/
public function load() {
- $entities = array(
- 'enabled' => array(),
- 'disabled' => array(),
- );
+ $entities = [
+ 'enabled' => [],
+ 'disabled' => [],
+ ];
+ /** @var \Drupal\entityqueue\EntityQueueInterface $entity */
foreach (parent::load() as $entity) {
+ // Don't display queues which can not be edited by the user.
+ if (!$entity->access('update')) {
+ continue;
+ }
if ($entity->status()) {
$entities['enabled'][] = $entity;
}
'handler' => $entity->getHandlerPlugin()->getPluginDefinition()['title'],
'items' => $this->getQueueItemsStatus($entity),
] + parent::buildRow($entity),
- 'title' => $this->t('Machine name: @name', array('@name' => $entity->id())),
+ 'title' => $this->t('Machine name: @name', ['@name' => $entity->id()]),
];
return $row;
$build['#type'] = 'container';
$build['#attributes']['id'] = 'entity-queue-list';
$build['#attached']['library'][] = 'core/drupal.ajax';
+ $build['#cache'] = [
+ 'contexts' => Cache::mergeContexts($this->entityType->getListCacheContexts(), ['user.permissions']),
+ 'tags' => $this->entityType->getListCacheTags(),
+ ];
- $build['enabled']['heading']['#markup'] = '<h2>' . $this->t('Enabled', array(), array('context' => 'Plural')) . '</h2>';
- $build['disabled']['heading']['#markup'] = '<h2>' . $this->t('Disabled', array(), array('context' => 'Plural')) . '</h2>';
+ $build['enabled']['heading']['#markup'] = '<h2>' . $this->t('Enabled', [], ['context' => 'Plural']) . '</h2>';
+ $build['disabled']['heading']['#markup'] = '<h2>' . $this->t('Disabled', [], ['context' => 'Plural']) . '</h2>';
- foreach (array('enabled', 'disabled') as $status) {
+ foreach (['enabled', 'disabled'] as $status) {
$build[$status]['#type'] = 'container';
- $build[$status]['#attributes'] = array('class' => array('entity-queue-list-section', $status));
- $build[$status]['table'] = array(
+ $build[$status]['#attributes'] = ['class' => ['entity-queue-list-section', $status]];
+ $build[$status]['table'] = [
'#type' => 'table',
- '#attributes' => array(
- 'class' => array('entity-queue-listing-table'),
- ),
+ '#attributes' => [
+ 'class' => ['entity-queue-listing-table'],
+ ],
'#header' => $this->buildHeader(),
- '#rows' => array(),
+ '#rows' => [],
'#cache' => [
'contexts' => $this->entityType->getListCacheContexts(),
'tags' => $this->entityType->getListCacheTags(),
],
- );
+ ];
foreach ($entities[$status] as $entity) {
$build[$status]['table']['#rows'][$entity->id()] = $this->buildRow($entity);
}
}
// Add AJAX functionality to enable/disable operations.
- foreach (array('enable', 'disable') as $op) {
+ foreach (['enable', 'disable'] as $op) {
if (isset($operations[$op])) {
$operations[$op]['url'] = $entity->toUrl($op);
// Enable and disable operations should use AJAX.