You are here

function page_title_taxonomy in Page Title 5.2

Same name and namespace in other branches
  1. 6.2 page_title.module \page_title_taxonomy()

Implementation of hook_taxonomy().

File

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

Code

function page_title_taxonomy($op, $type, $edit) {
  if ($type == 'vocabulary') {
    return;
  }
  switch ($op) {
    case 'update':
      if (user_access('set page title')) {
        db_query('DELETE FROM {page_title} WHERE type = "term" AND id = %d', $edit['tid']);
      }

    // Fallthrough to insert is intentional!
    case 'insert':
      if (isset($edit['page_title']) && drupal_strlen(trim($edit['page_title'])) > 0 && user_access('set page title')) {
        db_query('INSERT INTO {page_title} VALUES("term", %d, "%s")', $edit['tid'], $edit['page_title']);
      }
      break;
    case 'delete':
      db_query('DELETE FROM {page_title} WHERE type = "term" AND id = %d', $edit['tid']);
      break;
  }
}