Make the queue position available as a filter in views

Created on 21 February 2025, about 1 month ago

Problem/Motivation

I wish to have four distinct sections on my front page - but only use one entityqueue (called Frontpage).

Section 1: Just in. Queue position 1-5 in Frontpage. 5 elements. All article nodes.
Section 2: News. Queue position>6 in Frontpage. Only article nodes tagged with news. 5 elements
Section 3: Reviews. Queue position>6 in Frontpage. Only article nodes tagged with review. 5 elements
Section 4: Commentary. Queue position>6 in Frontpage. Only article nodes tagged with commentary. 5 elements

I could solve this using 4 distinct queues and have a script copy items from the master queue to the slave queues.

But a position filter in views would solve the problem better.

We already get queue position as a field and a sort.

Proposed resolution

Add stuff to /entityqueue/entityqueue.views.inc

Something along the lines of

$data[$target_base_table]['entityqueue_relationship_position']['filter'] = [
      'id' => 'entity_queue_position',
      'type' => 'integer',
      'group' => t('Entityqueue'),
      'title' => t('@target_label Queue Position', [
        '@target_label' => $entity_type->getLabel(),
      ]),
      'label' => t('@target_label Queue Position', [
        '@target_label' => $entity_type->getLabel(),
      ]),
      'help' => t('Filter by position in the @target_label queue.', [
        '@target_label' => $entity_type->getLabel(),
      ]),
      'field' => 'delta',
      'field table' => $subqueue_items_table_name,
      'operator' => ['<', '>', ''>=', '<=', '=', '!=' ],
      'field field' => $columns['target_id'],
    ];
Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇩🇰Denmark Steven Snedker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024