Projet

Général

Profil

Paste
Télécharger (1,22 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / UrbanSolice / template.php @ 1f623f01

1 85ad3d82 Assos Assos
<?php
2
3
/**
4
 * Set count variables so column numbers can be dynamic.
5
 */
6
function urbansolice_preprocess_page (&$vars) {
7
  $vars['preface'] = count(array_filter(array($vars['page']['preface_one'], $vars['page']['preface_two'], $vars['page']['preface_three'])));
8
  $vars['bottom'] = count(array_filter(array($vars['page']['bottom_one'], $vars['page']['bottom_two'], $vars['page']['bottom_three'], $vars['page']['bottom_four'])));
9
  // Display user account links.
10
  $vars['user_links'] = _urbansolice_user_links();
11
  //dpm($vars);
12
}
13
14
/**
15
 * User/account related links.
16
 */
17
function _urbansolice_user_links() {
18
  // Add user-specific links
19
  global $user;
20
  $user_links = array();
21
  if (empty($user->uid)) {
22
    $user_links['login'] = array('title' => t('Login'), 'href' => 'user');
23
    // Do not display register link if registration is not allowed.
24
    if (variable_get('user_register', 1)) {
25
      $user_links['register'] = array('title' => t('Register'), 'href' => 'user/register');
26
    }
27
  }
28
  else {
29
    $user_links['account'] = array('title' => t('Hello @username', array('@username' => $user->name)), 'href' => 'user', 'html' => TRUE);
30
    $user_links['logout'] = array('title' => t('Logout'), 'href' => "logout");
31
  }
32
  return $user_links;
33
}