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

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

This example Drupal source code file (page_title.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

drupal_get_title, drupal_is_front_page, empty, function, if, page_title_page_title_alter, page_title_page_title_pattern_alter, page_title_set_title, pattern, php, site-name, site-slogan, title, types

The page_title.page_title.inc Drupal example source code

<?php
// $Id: page_title.page_title.inc,v 1.1.4.3 2010/11/01 23:18:35 njt1982 Exp $

/**
 * @file
 * Page Title implementations of the page title hooks
 */


/**
 * Implementation of hook_page_title_alter().
 */
function page_title_page_title_alter(&$title) {
 // If nothing above set a title, give the legacy function a chance to act
  if (empty($title)) {
    $title = page_title_set_title();
  }

  // If we still have no title, fall back to the title provided by Drupal Core
  if (empty($title)) {
    $title = drupal_get_title();
  }
}


/**
 * Implementation of hook_page_title_pattern_alter().
 */
function page_title_page_title_pattern_alter(&$pattern, &$types) {
  // If frontpage, then use the frontpage pattern and set the title.
  if (drupal_is_front_page()) {
    // Get the frontpage pattern
    $pattern = variable_get('page_title_front', '[site-name] | [site-slogan]');
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal page_title.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.