summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/page_title/modules/page_title.page_title.inc
blob: b6034a94a708f9f34372e9f7e2776982cbfd5e3d (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

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


/**
 * Implements 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 = strip_tags(drupal_get_title());
  }
}


/**
 * Implements 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
    $settings = page_title_get_settings();
    $pattern = variable_get('page_title_front', $settings['page_title_front']['default']);
  }
}


/**
 * Implements hook_page_title_settings().
 */
function page_title_page_title_settings() {
  return array(
    'page_title_default' => array(
      'label' => 'Default',
      'scopes' => array('global'),
      'required' => TRUE,
      'show field' => FALSE,
      'description' => 'This pattern will be used as a <em>fallback</em> (ie, when no other pattern is defined)',
      'weight' => -50,
      'default' => '[current-page:page-title] | [site:name]',
    ),
    'page_title_front' => array(
      'label' => 'Frontpage',
      'scopes' => array('global'),
      'show field' => FALSE,
      'description' => 'This pattern will be used for the site frontpage',
      'weight' => -49,
      'default' => '[site:name] | [site:slogan]',
    ),
    'page_title_pager_pattern' => array(
      'label' => 'Pager Suffix',
      'scopes' => array('global'),
      'show field' => FALSE,
      'description' => 'This pattern will be appended to a page title for any given page with a pager on it',
      'weight' => -48,
    ),
  );
}