You are here

function taxonomy_title_get in Taxonomy Title 7

Retrieves the term title.

Parameters

(int) $tid: The taxonomy term id of the term to delete.

(bool) $default: Whether to return a global default value if no specific value is provided.

Return value

(string) The taxonomy term title for the term.

3 calls to taxonomy_title_get()
taxonomy_title_form_taxonomy_form_term_alter in ./taxonomy_title.module
Implements hook_form_FORM_ID_alter().
taxonomy_title_process_page in ./taxonomy_title.module
Implements hook_preprocess_page().
taxonomy_title_tokens in ./taxonomy_title.tokens.inc
Implements hook_tokens().

File

./taxonomy_title.module, line 154
Enhanced control over the heading tag for the taxonomy term list pages.

Code

function taxonomy_title_get($tid, $default = TRUE) {
  $title = db_query("SELECT title FROM {taxonomy_title} WHERE tid = :tid", array(
    ':tid' => $tid,
  ))
    ->fetchField();
  if ($title == FALSE && $default == TRUE) {

    // Check for global default value.
    $term = taxonomy_term_load($tid);
    $default = variable_get('taxonomy_title_default_' . $term->vid, '');
    $title = token_replace($default, array(
      'term' => $term,
    ));
  }
  if (function_exists('i18n_string_translate')) {
    $title = i18n_string_translate(array(
      'taxonomy_title',
      'term',
      $tid,
      'title',
    ), $title, array(
      'sanitize' => FALSE,
    ));
  }
  return $title;
}