You are here

function taxonomy_image_attach_get_image_nodes in Taxonomy Image 5

Same name and namespace in other branches
  1. 6 contributed/taxonomy_image_attach/taxonomy_image_attach.module \taxonomy_image_attach_get_image_nodes()

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

Direct copy of the way image_attach does so

See also

_image_attach_get_image_nodes()

1 call to taxonomy_image_attach_get_image_nodes()
taxonomy_image_attach_form_alter in contributed/taxonomy_image_attach/taxonomy_image_attach.module
Add an image selector to the taxonomy_image fieldset alongside the upload field.

File

contributed/taxonomy_image_attach/taxonomy_image_attach.module, line 122
Add functionality to terms similar to the image_attach.module. Allow a term editor to choose from EXISTING images rather than upload new ones all the time. Currently this uses image.module handling of image nodes to index available images.

Code

function taxonomy_image_attach_get_image_nodes() {
  $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.status=1 AND 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;
}