function page_title_node_type in Page Title 7.2
Same name and namespace in other branches
- 8.2 page_title.module \page_title_node_type()
- 5.2 page_title.module \page_title_node_type()
- 6.2 page_title.module \page_title_node_type()
- 6 page_title.module \page_title_node_type()
- 7 page_title.module \page_title_node_type()
Implement hook_node_type().
Updates settings after a node type change.
File
- ./
page_title.module, line 155 - Enhanced control over the page title (in the head tag).
Code
function page_title_node_type($op, $info) {
// Handle a content type rename
if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) {
// Load the old node type settings.
$temp = variable_get('page_title_type_' . $info->old_type, '');
// If the settings aren't empty, then save them into the new type
if (!empty($temp)) {
variable_set('page_title_type_' . $info->type, $temp);
}
// Delete the old setting
variable_del('page_title_type_' . $info->old_type);
// Essentially, do the same as above but with the _showfield suffix for the node type
$temp = variable_get('page_title_type_' . $info->old_type . '_showfield', 0);
if ($temp) {
variable_set('page_title_type_' . $info->type . '_showfield', $temp);
}
variable_del('page_title_type_' . $info->old_type . '_showfield');
}
// If deleted, remove the variables
if ($op == 'delete') {
variable_del('page_title_type_' . $info->type);
variable_del('page_title_type_' . $info->type . '_showfield');
}
}