function _image_attach_get_image_nodes in Image 6
Same name and namespace in other branches
- 5.2 contrib/image_attach/image_attach.module \_image_attach_get_image_nodes()
- 5 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.
Parameters
$nids: A list of nids to filter on. If not passed, all image nids are returned.
2 calls to _image_attach_get_image_nodes()
- image_attach_form_alter in contrib/
image_attach/ image_attach.module - Implementation of hook_form_alter().
- image_generate_nodeapi in contrib/
image_generate/ image_generate.module - Implementation of hook_nodeapi().
File
- contrib/
image_attach/ image_attach.module, line 588 - image_attach.module
Code
function _image_attach_get_image_nodes($nids = array()) {
$placeholder = '';
// If $nids was passed, build placeholders to put in the query
if (count($nids)) {
$placeholder = 'AND n.nid IN (' . implode(', ', array_fill(0, sizeof($nids), '%d')) . ') ';
}
$rows = array(
0 => t('- None -'),
);
$result = db_query(db_rewrite_sql("SELECT n.nid, n.title, n.sticky FROM {node} n WHERE n.status = 1 AND n.type = 'image' " . $placeholder . "ORDER BY n.sticky DESC, n.title ASC"), $nids);
while ($node = db_fetch_object($result)) {
$rows[$node->nid] = $node->title;
}
return $rows;
}