You are here

function library_get_items_group_by_node in Library 7

Same name and namespace in other branches
  1. 5.2 library.module \library_get_items_group_by_node()
  2. 6.2 library.module \library_get_items_group_by_node()
  3. 6 library.module \library_get_items_group_by_node()

Returns a list of all library item nodes.

Return value

array An array of library items

1 call to library_get_items_group_by_node()
library_display_items in ./library.pages.inc
Display all library items.

File

./library.module, line 1132

Code

function library_get_items_group_by_node() {
  $select = db_select('library', 'l')
    ->extend('PagerDefault');
  $select
    ->join('node', 'n', 'n.nid = l.nid');
  $select
    ->fields('n', array(
    'nid',
  ))
    ->condition('n.status', 1)
    ->groupBy('n.nid')
    ->orderBy('n.title')
    ->limit(50);
  $result = $select
    ->execute();

  // @todo This loads items, but doesn't use paging.
  $nodes = array();
  while ($nid = $result
    ->FetchField()) {
    $nodes[] = node_load($nid);
  }
  return $nodes;
}