You are here

function page_title_node_type in Page Title 5.2

Same name and namespace in other branches
  1. 8.2 page_title.module \page_title_node_type()
  2. 6.2 page_title.module \page_title_node_type()
  3. 6 page_title.module \page_title_node_type()
  4. 7.2 page_title.module \page_title_node_type()
  5. 7 page_title.module \page_title_node_type()

Implementation of hook_node_type().

Updates settings after a node type change.

File

./page_title.module, line 77
Enhanced control over the page title (in the head tag).

Code

function page_title_node_type($op, $info) {
  if ($op == 'update' && !empty($info->old_type) and $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');
  }
}