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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

robbt created an issue. See original summary.

robbt’s picture

Title: EntityQueue not available as relationship for media items » EntityQueue not available as relationship for views of media items
lissy’s picture

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

lissy’s picture

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.

charly71’s picture

Same problem with taxonomy terms!

amateescu made their first commit to this issue’s fork.

amateescu’s picture

Version: 8.x-1.8 » 8.x-1.x-dev
Category: Feature request » Bug report
Status: Active » Needs review

The problem is that views_data is cached, and we need to clear that cache when adding (or deleting) queues.

  • amateescu committed a3d3ce1b on 8.x-1.x
    fix: #3466357 Clear views data when adding or deleting queues.
    
    By:...
amateescu’s picture

Status: Needs review » Fixed

Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.