You are here

function flag_flag::get_count in Flag 5

Same name and namespace in other branches
  1. 6.2 flag.inc \flag_flag::get_count()
  2. 6 flag.inc \flag_flag::get_count()
  3. 7.3 includes/flag/flag_flag.inc \flag_flag::get_count()
  4. 7.2 flag.inc \flag_flag::get_count()

Returns the number of times an item is flagged.

Thanks to using a cache, inquiring several different flags about the same item results in only one SQL query.

File

./flag.inc, line 494
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function get_count($content_id) {
  $counts = flag_get_counts($this->content_type, $content_id);
  return isset($counts[$this->name]) ? $counts[$this->name] : 0;
}