home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (taxonomy.page_title.inc)

This example Drupal source code file (taxonomy.page_title.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

_showfield, arg, args, function, if, is_numeric, page_title_load_title, pattern, php, taxonomy_page_title_pattern_alter, taxonomy_term_load, term, term_title, types

The taxonomy.page_title.inc Drupal example source code

<?php
// $Id: taxonomy.page_title.inc,v 1.1.4.3 2010/11/01 21:25:11 njt1982 Exp $

/**
 * @file
 * Taxonomy implementations of the page title hooks
 */


/**
 * Implementation of hook_page_title_alter().
 */
function taxonomy_page_title_alter(&$title) {
  // If we're looking at a taxonomy term page, get the term title
  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
    $term = taxonomy_term_load(arg(2));
    if (variable_get('page_title_vocab_'. $term->vid .'_showfield', 0) && ($term_title = page_title_load_title($term->tid, 'term'))) {
      $title = $term_title;
    }
  }
}


/**
 * Implementation of hook_page_title_pattern_alter().
 */
function taxonomy_page_title_pattern_alter(&$pattern, &$types) {
  // Taxonomy Term Page
  if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)) && module_exists('taxonomy')) {
    $types['taxonomy'] = taxonomy_term_load(arg(2));
    $pattern = variable_get('page_title_vocab_'. $types['taxonomy']->vid, '');
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal taxonomy.page_title.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.