You are here

function page_title_taxonomy in Page Title 6.2

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

Implementation of hook_taxonomy().

File

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

Code

function page_title_taxonomy($op, $type, $edit) {
  if ($type == 'vocabulary') {
    switch ($op) {
      case 'delete':
      case 'update':
      case 'insert':

        // Flush the settings on update/insert.
        page_title_get_settings(TRUE);
        break;
    }
  }
  elseif ($type == 'term') {
    switch ($op) {
      case 'update':
        if (isset($edit['page_title']) && 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;
    }
  }
}