You are here

function node_gallery_api_get_gallery_list in Node Gallery 7

Returns an array of galleries, suitable for use in a form select.

Parameters

string $type: The content type of the galleries to be queried.

int $uid: (optional) if specified, the list returned will only contain galleries the user can modify.

Return value

array Associative array where the keys are the nid, and the value is the node title.

File

./node_gallery_api.inc, line 1013
Node Gallery API function

Code

function node_gallery_api_get_gallery_list($type, $uid = NULL) {
  $query = db_select('node', 'n')
    ->fields('n', array(
    'nid',
    'title',
  ))
    ->condition('type', $type);
  $items = array();
  if ($uid) {
    $query
      ->condition('uid', $uid);
  }
  $result = $query
    ->execute();
  foreach ($result as $r) {
    $items[$r->nid] = $r->title;
  }
  return $items;
}