function nat_set_config in Node Auto Term [NAT] 5
Same name and namespace in other branches
- 6.2 nat.module \nat_set_config()
- 6 nat.module \nat_set_config()
- 7.2 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.
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.
$body: Boolean to indicated if the node body should be in sync with the term description field.
$related: Boolean to indicate if related terms and synonyms can be set during node creation.
File
- ./
nat.module, line 510 - 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, $body = FALSE, $related = FALSE) {
$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;
}
if ($body) {
$nat_config['body'][$type] = TRUE;
}
if ($related) {
$nat_config['related'][$type] = TRUE;
}
variable_set('nat_config', $nat_config);
}