You are here

function flag_flag::fetch_entity in Flag 7.3

Fetches, possibly from some cache, an entity this flag works with.

12 calls to flag_flag::fetch_entity()
flag_comment::get_flagging_record in includes/flag/flag_comment.inc
Overrides flag_flag::get_flagging_record().
flag_comment::get_flag_action in includes/flag/flag_comment.inc
Returns a 'flag action' object.
flag_comment::get_relevant_action_objects in includes/flag/flag_comment.inc
Returns objects the action may possible need.
flag_comment::replace_tokens in includes/flag/flag_comment.inc
Replaces tokens.
flag_entity::get_flag_action in includes/flag/flag_entity.inc
Returns a 'flag action' object.

... See full list

File

includes/flag/flag_flag.inc, line 341
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 fetch_entity($entity_id, $object_to_remember = NULL) {
  static $cache = array();
  if (isset($object_to_remember)) {
    $cache[$entity_id] = $object_to_remember;
  }
  if (!array_key_exists($entity_id, $cache)) {
    $entity = $this
      ->_load_entity($entity_id);
    $cache[$entity_id] = $entity ? $entity : NULL;
  }
  return $cache[$entity_id];
}