function flag_flag::get_count in Flag 7.3
Same name and namespace in other branches
- 5 flag.inc \flag_flag::get_count()
- 6.2 flag.inc \flag_flag::get_count()
- 6 flag.inc \flag_flag::get_count()
- 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
- includes/
flag/ flag_flag.inc, line 1158 - Contains the flag_flag class. Flag type classes use an 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($entity_id) {
$counts = flag_get_counts($this->entity_type, $entity_id);
return isset($counts[$this->name]) ? $counts[$this->name] : 0;
}