Projet

Général

Profil

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

root / drupal7 / themes / garland / template.php @ 134c7813

1 85ad3d82 Assos Assos
<?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 582db59d Assos Assos
function garland_preprocess_maintenance_page(&$variables) {
23 85ad3d82 Assos Assos
  // 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 582db59d Assos Assos
  garland_preprocess_html($variables);
29 85ad3d82 Assos Assos
}
30
31
/**
32
 * Override or insert variables into the html template.
33
 */
34 582db59d Assos Assos
function garland_preprocess_html(&$variables) {
35 85ad3d82 Assos Assos
  // Toggle fixed or fluid width.
36
  if (theme_get_setting('garland_width') == 'fluid') {
37 582db59d Assos Assos
    $variables['classes_array'][] = 'fluid-width';
38 85ad3d82 Assos Assos
  }
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 582db59d Assos Assos
function garland_process_html(&$variables) {
47 85ad3d82 Assos Assos
  // Hook into color.module
48
  if (module_exists('color')) {
49 582db59d Assos Assos
    _color_html_alter($variables);
50 85ad3d82 Assos Assos
  }
51
}
52
53
/**
54
 * Override or insert variables into the page template.
55
 */
56 582db59d Assos Assos
function garland_preprocess_page(&$variables) {
57 85ad3d82 Assos Assos
  // Move secondary tabs into a separate variable.
58 582db59d Assos Assos
  $variables['tabs2'] = array(
59 85ad3d82 Assos Assos
    '#theme' => 'menu_local_tasks',
60 582db59d Assos Assos
    '#secondary' => $variables['tabs']['#secondary'],
61 85ad3d82 Assos Assos
  );
62 582db59d Assos Assos
  unset($variables['tabs']['#secondary']);
63 85ad3d82 Assos Assos
64 582db59d Assos Assos
  if (isset($variables['main_menu'])) {
65
    $variables['primary_nav'] = theme('links__system_main_menu', array(
66
      'links' => $variables['main_menu'],
67 85ad3d82 Assos Assos
      '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 582db59d Assos Assos
    $variables['primary_nav'] = FALSE;
79 85ad3d82 Assos Assos
  }
80 582db59d Assos Assos
  if (isset($variables['secondary_menu'])) {
81
    $variables['secondary_nav'] = theme('links__system_secondary_menu', array(
82
      'links' => $variables['secondary_menu'],
83 85ad3d82 Assos Assos
      '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 582db59d Assos Assos
    $variables['secondary_nav'] = FALSE;
95 85ad3d82 Assos Assos
  }
96
97
  // Prepare header.
98
  $site_fields = array();
99 582db59d Assos Assos
  if (!empty($variables['site_name'])) {
100
    $site_fields[] = $variables['site_name'];
101 85ad3d82 Assos Assos
  }
102 582db59d Assos Assos
  if (!empty($variables['site_slogan'])) {
103
    $site_fields[] = $variables['site_slogan'];
104 85ad3d82 Assos Assos
  }
105 582db59d Assos Assos
  $variables['site_title'] = implode(' ', $site_fields);
106 85ad3d82 Assos Assos
  if (!empty($site_fields)) {
107
    $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
108
  }
109 582db59d Assos Assos
  $variables['site_html'] = implode(' ', $site_fields);
110 85ad3d82 Assos Assos
111
  // Set a variable for the site name title and logo alt attributes text.
112 582db59d Assos Assos
  $slogan_text = $variables['site_slogan'];
113
  $site_name_text = $variables['site_name'];
114
  $variables['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
115 85ad3d82 Assos Assos
}
116
117
/**
118
 * Override or insert variables into the node template.
119
 */
120 582db59d Assos Assos
function garland_preprocess_node(&$variables) {
121
  $variables['submitted'] = $variables['date'] . '' . $variables['name'];
122 85ad3d82 Assos Assos
}
123
124
/**
125
 * Override or insert variables into the comment template.
126
 */
127 582db59d Assos Assos
function garland_preprocess_comment(&$variables) {
128
  $variables['submitted'] = $variables['created'] . '' . $variables['author'];
129 85ad3d82 Assos Assos
}
130
131
/**
132
 * Override or insert variables into the block template.
133
 */
134 582db59d Assos Assos
function garland_preprocess_block(&$variables) {
135
  $variables['title_attributes_array']['class'][] = 'title';
136
  $variables['classes_array'][] = 'clearfix';
137 85ad3d82 Assos Assos
}
138
139
/**
140
 * Override or insert variables into the page template.
141
 */
142 582db59d Assos Assos
function garland_process_page(&$variables) {
143 85ad3d82 Assos Assos
  // Hook into color.module
144
  if (module_exists('color')) {
145 582db59d Assos Assos
    _color_page_alter($variables);
146 85ad3d82 Assos Assos
  }
147
}
148
149
/**
150
 * Override or insert variables into the region template.
151
 */
152 582db59d Assos Assos
function garland_preprocess_region(&$variables) {
153
  if ($variables['region'] == 'header') {
154
    $variables['classes_array'][] = 'clearfix';
155 85ad3d82 Assos Assos
  }
156
}