本文整理汇总了PHP中EntityFieldQuery::tableSort方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityFieldQuery::tableSort方法的具体用法?PHP EntityFieldQuery::tableSort怎么用?PHP EntityFieldQuery::tableSort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityFieldQuery
的用法示例。
在下文中一共展示了EntityFieldQuery::tableSort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subqueues_page
/**
* 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;
}