You are here

function page_title_nodeapi in Page Title 6

Same name and namespace in other branches
  1. 5.2 page_title.module \page_title_nodeapi()
  2. 5 page_title.module \page_title_nodeapi()
  3. 6.2 page_title.module \page_title_nodeapi()

Implementation of hook_nodeapi().

File

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

Code

function page_title_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'update':
      db_query("DELETE FROM {page_title} WHERE nid = %d", $node->nid);

    // fallthrough to insert intentional!
    case 'insert':
      if (isset($node->page_title) && strlen(trim($node->page_title)) > 0) {
        db_query("INSERT INTO {page_title} VALUES (%d, '%s')", $node->nid, $node->page_title);
      }
      break;
    case 'delete':
      db_query('DELETE FROM {page_title} WHERE nid = %d', $node->nid);
      break;
    case 'load':
      return array(
        'page_title' => page_title_node_get_title($node->nid),
      );
  }
}