function location_taxonomize_term_attach_bulk in Location Taxonomize 7.2
1 call to location_taxonomize_term_attach_bulk()
File
- ./
location_taxonomize.module, line 414
Code
function location_taxonomize_term_attach_bulk($tids, $nid) {
$langcode = 'und';
// load the node
$node = node_load($nid);
if (!isset($node->field_location_taxonomize_terms)) {
return;
}
// Reverse the order to assign the lowest term in the hierarchy first
$tids = array_reverse($tids);
$tids = array_unique($tids);
$save = array();
foreach ($tids as $tid) {
$save[$langcode][]['tid'] = $tid;
}
$node->field_location_taxonomize_terms = $save;
node_save($node);
}