currentUser = $current_user; } /** * {@inheritdoc} */ public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { return new static( $configuration, $plugin_id, $plugin_definition, $container->get('current_user') ); } /** * {@inheritdoc} */ public function query() { $this->ensureMyTable(); // Try to find an entity queue relationship in this view, and pick the first // one available. $entity_queue_relationship = NULL; foreach ($this->view->relationship as $id => $relationship) { if ($relationship instanceof EntityQueueRelationship) { $entity_queue_relationship = $relationship; $this->options['relationship'] = $id; $this->setRelationship(); break; } } if ($entity_queue_relationship) { $subqueue_items_table_alias = $entity_queue_relationship->first_alias; $field_field = $this->definition['field field']; $operator = $this->value ? 'IS NOT NULL' : 'IS NULL'; $condition = "$subqueue_items_table_alias.$field_field $operator"; $this->query->addWhereExpression($this->options['group'], $condition); } else { if ($this->currentUser->hasPermission('administer views')) { drupal_set_message($this->t('In order to filter on items from the queue, you need to add the Entityqueue: Queue relationship on View: @view with display: @display', ['@view' => $this->view->storage->label(), '@display' => $this->view->current_display]), 'error'); } } } }