function nat_set_config in Node Auto Term [NAT] 7.2
Same name and namespace in other branches
- 5 nat.module \nat_set_config()
- 6.2 nat.module \nat_set_config()
- 6 nat.module \nat_set_config()
- 7 nat.module \nat_set_config()
Update the NAT config to include node->vocabulary associations and related settings. Commonly used in .install files to register associations and save the admin some work. @todo Add the new field association option?
Parameters
$type: The node type.
$vids: Array of vocabulary IDs that the above node type is to be associated with via NAT.
$delete: Boolean to indicate if associated term should be deleted when a node is deleted.
$links: Boolean to indicate if links to NAT terms should point to the associated nodes instead.
File
- ./
nat.module, line 503 - NAT - node auto term - is a helper module that automatically creates a term using the same title as a node.
Code
function nat_set_config($type, $vids, $delete = TRUE, $links = TRUE) {
$nat_config = _nat_variable_get();
if (!isset($nat_config['types'][$type])) {
$nat_config['types'][$type] = array();
}
foreach ($vids as $vid) {
$nat_config['types'][$type][$vid] = $vid;
}
if ($delete) {
$nat_config['delete'][$type] = TRUE;
}
if ($links) {
$nat_config['links'][$type] = TRUE;
}
variable_set('nat_config', $nat_config);
}