function _nat_update_terms in Node Auto Term [NAT] 7
Same name and namespace in other branches
- 5 nat.module \_nat_update_terms()
- 6.2 nat.module \_nat_update_terms()
- 6 nat.module \_nat_update_terms()
- 7.2 nat.module \_nat_update_terms()
Update saved node-terms.
Parameters
Object $node: The node object to associate and update.
1 call to _nat_update_terms()
- nat_node_update in ./
nat.module - Implements hook_node_update().
File
- ./
nat.module, line 582 - NAT - node auto term - is a helper module that automatically creates a term using the same title as a node.
Code
function _nat_update_terms($node) {
$associations = _nat_variable_get('associations');
$hierarchy = _nat_get_term_hierarchies($node);
$nat_terms = nat_get_terms($node->nid);
$terms = taxonomy_term_load_multiple(array_keys($nat_terms));
$terms_saved = array();
foreach ($terms as $term) {
$fields = $associations[$node->type][$term->vid];
// Load entity fields.
$entities = entity_load('taxonomy_term', array(
$term->tid,
));
$terms_saved[] = _nat_save_term($node, $hierarchy, $term, $entities, $fields);
}
return $terms_saved;
}