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

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


/**
 * Implements hook_page_title_alter().
 */
function blog_page_title_alter(&$title) {
  $menu_item = menu_get_item();

  // If we're looking at a users blog page, get the user title
  if (!strncmp($menu_item['path'], 'blog/%', 6) && ($user = menu_get_object('user_uid_optional'))) {
    if (variable_get('page_title_blog_showfield', 0) && ($blog_title = page_title_load_title(arg(1), 'user'))) {
      $title = $blog_title;
    }
  }
}


/**
 * Implements hook_page_title_pattern_alter().
 */
function blog_page_title_pattern_alter(&$pattern, &$types) {
  $menu_item = menu_get_item();

  if (!strncmp($menu_item['path'], 'blog/%', 6) && ($user = menu_get_object('user_uid_optional'))) {
    $types['user'] = $user;
    $pattern = variable_get('page_title_blog', '');
  }
}


/**
 * Implements hook_page_title_settings().
 */
function blog_page_title_settings() {
  return array(
    'page_title_blog' => array(
      'label' => 'Blog Homepage',
      'scopes' => array('global', 'user'),
      'show field' => FALSE,
      'description' => 'This pattern will be used for a users blog page (ie <code>/blog/1</code>)',
    ),
  );
}