EntityQueue not available as relationship for media items

Created on 6 August 2024, 11 months ago

Problem/Motivation

I am trying to utilize EntityQueue to select which media items to display in a view. I have done this successfully for content based views but when I create a media view EntityQueue is not listed under the relationships tab. This makes it impossible to set up the relationship with a specific entityqueue to only display media items that are located in the entityqueue

Steps to reproduce

Create a media entityqueue - add media items to the entitiyqueue
Create a view that displays media
Click on Relationship - and see that there is no option to create a relationship between the media items and an entityqueue.

Proposed resolution

Similar to ContentQueue you should be able to create a EntityQueue containing media items and filter view items using the relationship and selecting the specific queue via name under arguments.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.8

Component

Code

Created by

🇺🇸United States robbt

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

Comments & Activities

  • Issue created by @robbt
  • 🇺🇸United States robbt
  • 🇩🇪Germany lissy

    I have the same problem with a media view.
    There is no relation possible to EntityQueue.
    Some ideas?

  • 🇩🇪Germany lissy

    Can it be that simple? I wrote the following hook in my Custom-Module

    
    use Drupal\views\ViewExecutable;
    use Drupal\views\Plugin\views\query\QueryPluginBase;
    
    
    /*
     * Implements hook_views_data_alter().
     */
    function custommodule_views_data_alter(array &$data) {
        \Drupal::messenger()->addMessage('media_field_data');
      // Füge der media_field_data-Tabelle eine Beziehung zur Entityqueue-Subqueue-Items-Tabelle hinzu.
      $data['media_field_data']['entityqueue_sortierliste_items'] = [
        'title' => t('Entityqueue: Subqueue Items (Downloads)'),
        'help' => t('Verbindet Medien mit Subqueue Items in "sortierliste_dateien".'),
        'relationship' => [
          'title' => t('Referenzierte Subqueue Items für Downloads'),
          'help' => t('Stellt eine Beziehung zu Subqueue Items her, die Medien in "sortierliste_dateien" enthalten.'),
          'base' => 'entity_subqueue__items',
          'base field' => 'items_target_id', // Die Zielentität in der Subqueue (media.id)
          'relationship field' => 'mid',     // media_field_data.id
          'id' => 'standard',
          'label' => t('Entityqueue Items'),
        ],
      ];
    }
    
    

    Then I can sort the relation Sort list media and sort with this relation.
    It works for me.

Production build 0.71.5 2024