/** * * Given a contact id, it returns an array of tag id's the * contact belongs to. * * @param int $entityID * Id of the entity usually the contactID. * @param string $entityTable * Name of the entity table usually 'civicrm_contact'. * * @return array * reference $tag array of category id's the contact belongs to. * */ public static function &getTag($entityID, $entityTable = 'civicrm_contact') { $tags = array(); $entityTag = new CRM_Core_BAO_EntityTag(); $entityTag->entity_id = $entityID; $entityTag->entity_table = $entityTable; $entityTag->find(); while ($entityTag->fetch()) { $tags[$entityTag->tag_id] = $entityTag->tag_id; } return $tags; }