You are here

function _image_attach_get_image_nodes in Image 5

Same name and namespace in other branches
  1. 5.2 contrib/image_attach/image_attach.module \_image_attach_get_image_nodes()
  2. 6 contrib/image_attach/image_attach.module \_image_attach_get_image_nodes()

Fetch an array of all candidate referenced nodes, for use in presenting the selection form to the user.

1 call to _image_attach_get_image_nodes()
image_attach_form_alter in contrib/image_attach/image_attach.module
implementation of hook_form_alter()

File

contrib/image_attach/image_attach.module, line 329
image_attach.module

Code

function _image_attach_get_image_nodes() {
  $result = db_query(db_rewrite_sql("SELECT n.nid, n.title, n.sticky FROM {node} n WHERE n.status = 1 AND n.type = 'image' ORDER BY n.sticky DESC, n.title ASC"));
  if (db_num_rows($result) == 0) {
    return array();
  }
  $rows = array(
    0 => t('None'),
  );
  while ($node = db_fetch_object($result)) {
    $rows[$node->nid] = $node->title;
  }
  return $rows;
}