You are here

page_title.tokens.inc in Page Title 7.2

Same filename and directory in other branches
  1. 8.2 page_title.tokens.inc

Builds placeholder replacement tokens for page titles.

File

page_title.tokens.inc
View source
<?php

/**
 * @file
 * Builds placeholder replacement tokens for page titles.
 */

/**
 * Implements hook_token_info().
 */
function page_title_token_info() {
  $info['tokens']['current-page']['page-title'] = array(
    'name' => t('Page Title'),
    'description' => t('The title of the current page, as processed by the Page Title module.'),
  );
  return $info;
}

/**
 * Implements hook_token_values().
 */
function page_title_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();
  $sanitize = !empty($options['sanitize']);
  if ($type == 'current-page') {
    foreach ($tokens as $name => $original) {
      switch ($name) {
        case 'page-title':
          $replacements[$original] = page_title_get_title(!$sanitize);
          break;
      }
    }
  }
  return $replacements;
}

Functions

Namesort descending Description
page_title_tokens Implements hook_token_values().
page_title_token_info Implements hook_token_info().