Projet

Général

Profil

Paste
Télécharger (4,35 ko) Statistiques
| Branche: | Révision:

root / drupal7 / themes / garland / template.php @ db2d93dd

1
<?php
2

    
3
/**
4
 * Override of theme_breadcrumb().
5
 */
6
function garland_breadcrumb($variables) {
7
  $breadcrumb = $variables['breadcrumb'];
8

    
9
  if (!empty($breadcrumb)) {
10
    // Provide a navigational heading to give context for breadcrumb links to
11
    // screen-reader users. Make the heading invisible with .element-invisible.
12
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
13

    
14
    $output .= '<div class="breadcrumb">' . implode('', $breadcrumb) . '</div>';
15
    return $output;
16
  }
17
}
18

    
19
/**
20
 * Override or insert variables into the maintenance page template.
21
 */
22
function garland_preprocess_maintenance_page(&$vars) {
23
  // While markup for normal pages is split into page.tpl.php and html.tpl.php,
24
  // the markup for the maintenance page is all in the single
25
  // maintenance-page.tpl.php template. So, to have what's done in
26
  // garland_preprocess_html() also happen on the maintenance page, it has to be
27
  // called here.
28
  garland_preprocess_html($vars);
29
}
30

    
31
/**
32
 * Override or insert variables into the html template.
33
 */
34
function garland_preprocess_html(&$vars) {
35
  // Toggle fixed or fluid width.
36
  if (theme_get_setting('garland_width') == 'fluid') {
37
    $vars['classes_array'][] = 'fluid-width';
38
  }
39
  // Add conditional CSS for IE6.
40
  drupal_add_css(path_to_theme() . '/fix-ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
41
}
42

    
43
/**
44
 * Override or insert variables into the html template.
45
 */
46
function garland_process_html(&$vars) {
47
  // Hook into color.module
48
  if (module_exists('color')) {
49
    _color_html_alter($vars);
50
  }
51
}
52

    
53
/**
54
 * Override or insert variables into the page template.
55
 */
56
function garland_preprocess_page(&$vars) {
57
  // Move secondary tabs into a separate variable.
58
  $vars['tabs2'] = array(
59
    '#theme' => 'menu_local_tasks',
60
    '#secondary' => $vars['tabs']['#secondary'],
61
  );
62
  unset($vars['tabs']['#secondary']);
63

    
64
  if (isset($vars['main_menu'])) {
65
    $vars['primary_nav'] = theme('links__system_main_menu', array(
66
      'links' => $vars['main_menu'],
67
      'attributes' => array(
68
        'class' => array('links', 'inline', 'main-menu'),
69
      ),
70
      'heading' => array(
71
        'text' => t('Main menu'),
72
        'level' => 'h2',
73
        'class' => array('element-invisible'),
74
      )
75
    ));
76
  }
77
  else {
78
    $vars['primary_nav'] = FALSE;
79
  }
80
  if (isset($vars['secondary_menu'])) {
81
    $vars['secondary_nav'] = theme('links__system_secondary_menu', array(
82
      'links' => $vars['secondary_menu'],
83
      'attributes' => array(
84
        'class' => array('links', 'inline', 'secondary-menu'),
85
      ),
86
      'heading' => array(
87
        'text' => t('Secondary menu'),
88
        'level' => 'h2',
89
        'class' => array('element-invisible'),
90
      )
91
    ));
92
  }
93
  else {
94
    $vars['secondary_nav'] = FALSE;
95
  }
96

    
97
  // Prepare header.
98
  $site_fields = array();
99
  if (!empty($vars['site_name'])) {
100
    $site_fields[] = $vars['site_name'];
101
  }
102
  if (!empty($vars['site_slogan'])) {
103
    $site_fields[] = $vars['site_slogan'];
104
  }
105
  $vars['site_title'] = implode(' ', $site_fields);
106
  if (!empty($site_fields)) {
107
    $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
108
  }
109
  $vars['site_html'] = implode(' ', $site_fields);
110

    
111
  // Set a variable for the site name title and logo alt attributes text.
112
  $slogan_text = $vars['site_slogan'];
113
  $site_name_text = $vars['site_name'];
114
  $vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
115
}
116

    
117
/**
118
 * Override or insert variables into the node template.
119
 */
120
function garland_preprocess_node(&$vars) {
121
  $vars['submitted'] = $vars['date'] . '' . $vars['name'];
122
}
123

    
124
/**
125
 * Override or insert variables into the comment template.
126
 */
127
function garland_preprocess_comment(&$vars) {
128
  $vars['submitted'] = $vars['created'] . '' . $vars['author'];
129
}
130

    
131
/**
132
 * Override or insert variables into the block template.
133
 */
134
function garland_preprocess_block(&$vars) {
135
  $vars['title_attributes_array']['class'][] = 'title';
136
  $vars['classes_array'][] = 'clearfix';
137
}
138

    
139
/**
140
 * Override or insert variables into the page template.
141
 */
142
function garland_process_page(&$vars) {
143
  // Hook into color.module
144
  if (module_exists('color')) {
145
    _color_page_alter($vars);
146
  }
147
}
148

    
149
/**
150
 * Override or insert variables into the region template.
151
 */
152
function garland_preprocess_region(&$vars) {
153
  if ($vars['region'] == 'header') {
154
    $vars['classes_array'][] = 'clearfix';
155
  }
156
}