function google_admanager_nodeapi in DFP Small Business (Google Ad Manager) 6.3
Same name and namespace in other branches
- 6.2 google_admanager.module \google_admanager_nodeapi()
Implementation of hook_nodeapi()
1 call to google_admanager_nodeapi()
- google_admanager_ctools_render_alter in ./
google_admanager.module - Implementation of hook_ctools_render_alter().
File
- ./
google_admanager.module, line 94
Code
function google_admanager_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// If $op is 'view', then $a4 relates to if the node is being viewed as a page
if (arg(0) == 'node' && $op == 'view' && $a4) {
// If we have enabled Node Type attributes, add it
if (variable_get('google_admanager_nodetype_attributes', FALSE)) {
google_admanager_set_variable('node_type', $node->type);
}
// If the node's taxonomy is not an array, or is but is empty, then return
// from this function - there is nothing more to do.
if (!is_array($node->taxonomy) || count($node->taxonomy) == 0) {
return;
}
// If we have not enabled any vocabs as attributes, then return from the
// function as there is nothing more to do.
$enabled_vocabs = variable_get('google_admanager_vocab_attributes', array());
if (count($enabled_vocabs) == 0) {
return;
}
// For every term, check if the vocab is enabled and, if so, add as an
// attribute.
foreach ($node->taxonomy as $tid => $term) {
if ($enabled_vocabs[$term->vid]) {
google_admanager_add_term_attribute($term);
}
}
}
}