You are here

function comment_page_title_alter in Page Title 8.2

Same name and namespace in other branches
  1. 6.2 modules/comment.page_title.inc \comment_page_title_alter()
  2. 7.2 modules/comment.page_title.inc \comment_page_title_alter()

Implements hook_page_title_alter().

File

modules/comment.page_title.inc, line 12
Comment implementations of the page title hooks

Code

function comment_page_title_alter(&$title) {

  // Get the current menu item and compare the path to the comment reply path.
  $menu_item = menu_get_item();
  if (!strncmp($menu_item['path'], 'comment/reply/%', 15) && ($node = menu_get_object('node', 2))) {

    // If the node has a custom page title and the node type is configured
    // to have a custom page title (ie, it's not a leftover from a previous
    // setting), then use it.
    if (!empty($node->page_title) && variable_get('page_title_type_' . $node->type . '_showfield', 0)) {
      $title = $node->page_title;
    }
    else {
      $title = $node->title;
    }
  }
}