function exclude_node_title_preprocess_page in Exclude Node Title 6
Same name and namespace in other branches
- 8 exclude_node_title.module \exclude_node_title_preprocess_page()
- 7 exclude_node_title.module \exclude_node_title_preprocess_page()
Implementation of hook_preprocess_page().
File
- ./
exclude_node_title.module, line 41 - Primarily Drupal hooks and global API functions to exclude node titles.
Code
function exclude_node_title_preprocess_page(&$vars, $hook) {
if (!user_access('use exclude node title')) {
// user doesn't have access to module
return;
}
// exclude from path node/<nid>
$nid = FALSE;
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
}
elseif (arg(0) == 'search' && variable_get('exclude_node_title_search', 0)) {
$vars['title'] = '';
return;
}
if ($nid) {
if (in_array($nid, variable_get('exclude_node_title_nid_list', array()))) {
// remove title on a per node id basis
$vars['title'] = '';
}
else {
// remove title on a per node type basis
if (isset($vars['node']) && is_object($vars['node'])) {
$node_type = $vars['node']->type;
}
elseif (is_numeric($nid)) {
$node = node_load($nid);
$node_type = $node->type;
unset($node);
// memory cleanup
}
$exclude_node_title_content_type = exclude_node_title_content_type();
if (!empty($exclude_node_title_content_type) && !empty($exclude_node_title_content_type[$node_type])) {
$vars['title'] = '';
}
}
}
}