Skip to content

Instantly share code, notes, and snippets.

@heitoralthmann
Created May 11, 2022 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heitoralthmann/9049a85a6bb0c4a867f30a5aabe67bbd to your computer and use it in GitHub Desktop.
Save heitoralthmann/9049a85a6bb0c4a867f30a5aabe67bbd to your computer and use it in GitHub Desktop.
Drupal entityqueue - How to get / load items programmatically
<?php
/**
* @file
*
* Assuming that you've created a queue using the simple queue handler,
* that means a subqueue has been created automatically with the same name
* as the queue.
* Therefore, to get the (sub)queue items programatically, you can do this:
*/
$queue = \Drupal::entityTypeManager()->getStorage('entity_subqueue')->load('queue_id');
$items = $queue->items->referencedEntities();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment