/** * Page callback; Displays a listing of subqueues for a queue. */ public function subqueues_page($js, $input, EntityQueue $queue) { $plugin = $this->plugin; drupal_set_title($this->get_page_title('subqueues', $queue)); _entityqueue_set_breadcrumb(); $header = array(array('data' => t('Id'), 'type' => 'property', 'specifier' => 'subqueue_id', 'class' => array('entityqueue-ui-subqueue-id')), array('data' => t('Subqueue'), 'type' => 'property', 'specifier' => 'label', 'class' => array('entityqueue-ui-subqueue-label')), array('data' => t('Operations'), 'class' => array('entityqueue-ui-subqueue-operations'))); $query = new EntityFieldQuery(); $query->entityCondition('entity_type', $this->entityType); $query->entityCondition('bundle', $queue->name); $query->pager(50); $query->tableSort($header); $results = $query->execute(); $ids = isset($results[$this->entityType]) ? array_keys($results[$this->entityType]) : array(); $subqueues = $ids ? entity_load($this->entityType, $ids) : array(); $rows = array(); foreach ($subqueues as $subqueue) { $ops = array(); if (entity_access('update', 'entityqueue_subqueue', $subqueue)) { $edit_op = str_replace('%entityqueue_subqueue', $subqueue->subqueue_id, ctools_export_ui_plugin_menu_path($plugin, 'edit subqueue', $queue->name)); $ops[] = l(t('edit items'), $edit_op); } if (entity_access('delete', 'entityqueue_subqueue', $subqueue)) { $delete_op = str_replace('%entityqueue_subqueue', $subqueue->subqueue_id, ctools_export_ui_plugin_menu_path($plugin, 'delete subqueue', $queue->name)); $ops[] = l(t('delete subqueue'), $delete_op); } $rows[] = array('data' => array(array('data' => $subqueue->subqueue_id, 'class' => array('entityqueue-ui-subqueue-id')), array('data' => filter_xss_admin($subqueue->label), 'class' => array('entityqueue-ui-subqueue-label')), array('data' => implode(' | ', $ops), 'class' => array('entityqueue-ui-subqueue-operations')))); } $render = array('table' => array('#theme' => 'table', '#header' => $header, '#rows' => $rows, '#empty' => t('There are no subqueues to display.')), 'pager' => array('#theme' => 'pager')); return $render; }