function hashtags_index_import in Hashtags 7
Import hashtags data from node body fields to 'hashtags_index' table
Return value
int number of rows added
2 calls to hashtags_index_import()
- hashtags_import_to_index_submit in ./
hashtags.module - Submit handler for 'Import hashtags to index' button
- hashtags_update_7002 in ./
hashtags.install - 1) Create a table for storing relations between hashtags, nodes and comments {hashtags_index} 2) Update Hashtags taxonomy: clean hash symbol for all saved hashtags #hash1 => hash1 3) Activate body fields for selected content types (that have…
File
- ./
hashtags.module, line 876
Code
function hashtags_index_import() {
db_delete('hashtags_index')
->execute();
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'node')
->fieldCondition('field_hashtags');
$entity_types = $query
->execute();
$batch = array(
'title' => t('Import data to Hashtags index table from nodes that related to hashtags'),
'operations' => array(),
'finished' => '_hashtags_index_batch_finished',
);
$count = 0;
foreach ($entity_types['node'] as $nid => $item) {
$batch['operations'][] = array(
'_hashtags_index_batch_process',
array(
$nid,
),
);
$count++;
}
batch_set($batch);
}