function node_gallery_views_handler_image_count::query in Node Gallery 6.2
File
- includes/
node_gallery_views_handler_image_count.inc, line 10 - node_gallery_handler_image_count.inc
Class
- node_gallery_views_handler_image_count
- @file node_gallery_handler_image_count.inc
Code
function query() {
$table = $this
->ensure_my_table();
$sql = "SELECT COUNT(*) FROM {node_galleries} ng JOIN {node} n on ng.nid = n.nid WHERE n.status = 1 AND ng.gid = %d";
$sql = str_replace('%d', $this->table . '.gid', $sql);
$this->query
->add_field('', "({$sql})", 'image_count');
$this->field_alias = 'image_count';
}