summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/page_title/page_title.tokens.inc
blob: 51970bcfd935657dea118c0676514e20d1ea27ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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;
}