summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/page_title/modules/user.page_title.inc
blob: f67fb4478f8c4b48d9e76e1a1348ce9488023e9f (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
<?php

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


/**
 * Implements hook_page_title_alter().
 */
function user_page_title_alter(&$title) {
  // If we're looking at either a user profile page, get the user title
  if ( ($user = menu_get_object('user')) &&
       variable_get('page_title_user_showfield', 0) &&
       ($user_title = page_title_load_title($user->uid, 'user')) ) {
    $title = $user_title;
  }
}


/**
 * Implements hook_page_title_pattern_alter().
 */
function user_page_title_pattern_alter(&$pattern, &$types) {
  if ($user = menu_get_object('user')) {
    $types['user'] = $user;
    $pattern = variable_get('page_title_user', '');
  }
}


/**
 * Implements hook_page_title_settings().
 */
function user_page_title_settings() {
  return array(
    'page_title_user' => array(
      'label' => 'User Profile',
      'scopes' => array('global', 'user'),
      'show field' => TRUE,
      'description' => 'This pattern will be used for a user profile page (eg <code>/user/1</code>)',
    ),
  );
}