function _hashtags_index_add in Hashtags 7
Add hashtag index to database
Parameters
int $entity_id id of entity (node/user/custom entity):
int $tid id of hashtag:
string $type entity type of entity_id entity:
int $comment_id id of comment; should be setup if : hashtag should be related to comment; NULL if added hashtag relates to entity. Same hashtag can be related to entity & comment. in this case it should be added 2 rows. One with comment_id = NULL, second with id of comment For example: 1) array(entity_id = 2, tid = 5, comment_id = NULL) 2) array(entity_id = 2, tid = 5, comment_id = 6)
Return value
TRUE, @TODO: try {} catch {}
2 calls to _hashtags_index_add()
- hashtags_comment_presave in ./
hashtags.module - Implements hook_comment_presave().
- hashtags_entity_presave in ./
hashtags.module - Implementation of hook_entity_presave().
File
- ./
hashtags.module, line 491
Code
function _hashtags_index_add($entity_id, $type, $tid, $comment_id = NULL) {
db_insert('hashtags_index')
->fields(array(
'entity_id' => $entity_id,
'type' => $type,
'tid' => $tid,
'comment_id' => $comment_id,
))
->execute();
return TRUE;
}