You are here

function entityqueue_queue_load_multiple in Entityqueue 7

Loads multiple queues.

Parameters

array $names: An array of machine names of the queues to be loaded. If $names is empty, load all queues.

Return value

EntityQueue[] An array of EntityQueue objects, keyed by queue name.

5 calls to entityqueue_queue_load_multiple()
entityqueue_entity_info in ./entityqueue.module
Implements hook_entity_info().
entityqueue_get_options in ./entityqueue.module
Returns all queues or subqueues in a way which can be used on form options.
entityqueue_permission in ./entityqueue.module
Implements hook_permission().
entityqueue_queue_load in ./entityqueue.module
Loads a queue.
entityqueue_views_data_alter in includes/views/entityqueue.views.inc
Implements hook_views_data_alter().
1 string reference to 'entityqueue_queue_load_multiple'
entityqueue_schema in ./entityqueue.install
Implements hook_schema().

File

./entityqueue.module, line 224
Allows users to collect entities in arbitrarily ordered lists.

Code

function entityqueue_queue_load_multiple($names = array(), $reset = FALSE) {
  ctools_include('export');
  $queues = !empty($names) ? ctools_export_load_object('entityqueue_queue', 'names', $names) : ctools_export_crud_load_all('entityqueue_queue', $reset);

  // Bail out early if we haven't found any queues.
  if (empty($queues)) {
    return array();
  }
  static $recursion = FALSE;
  if (!$recursion && !drupal_static('entityqueue_install')) {
    $recursion = TRUE;
    foreach ($queues as $name => $queue) {
      if (!empty($queue->in_code_only)) {
        _entityqueue_queue_ensure_instance($queue);

        // Invoke a special queue handler method for queues that are stored only
        // in code (e.g. a hook_entityqueue_default_queues() implementation).
        entityqueue_get_handler($queue)
          ->loadFromCode();
      }
      entityqueue_get_handler($queue)
        ->load();
    }
  }
  $recursion = FALSE;
  return $queues;
}