function _hashtags_index_get_all_tags in Hashtags 7
Return a array(name => tid) list of all hashtags that related to current entity (own hashtags & all comments hashtags)
Parameters
int $entity_id:
string $type:
Return value
array (name => tid)
1 call to _hashtags_index_get_all_tags()
- _hashtags_index_sync_tags in ./
hashtags.module - Syncronize tags from 'hashtags_index' to field_hashtags. Must be called inside hook_entity_presave()
File
- ./
hashtags.module, line 556
Code
function _hashtags_index_get_all_tags($entity_id, $type) {
$result = db_query('SELECT hi.tid, td.name
FROM {hashtags_index} hi
INNER JOIN {taxonomy_term_data} td ON hi.tid = td.tid
WHERE hi.entity_id = :entity_id
AND hi.type = :type
GROUP BY hi.tid', array(
':entity_id' => $entity_id,
':type' => $type,
));
$tags = array();
foreach ($result as $data) {
$tags[$data->name] = $data->tid;
}
return $tags;
}