You are here

function flag_properties_get_flagged_entities in Flag 7.3

Getter callback that returns entities the given user flagged.

1 string reference to 'flag_properties_get_flagged_entities'
flag_entity_property_info_alter in ./flag.info.inc
Implements hook_entity_property_info_alter().

File

./flag.module, line 2634
The Flag module.

Code

function flag_properties_get_flagged_entities($entity, array $options, $name, $entity_type, $property_info) {

  // Need the entity type the flag applies to.
  $flag_entity_type = $property_info['flag_entity_type'];
  $flagging_data = flag_get_user_flags($flag_entity_type, NULL, $entity->uid);
  $flag_name = $property_info['flag_name'];
  if (isset($flagging_data[$flag_name])) {
    return array_keys($flagging_data[$flag_name]);
  }
  return array();
}