Projet

Général

Profil

Paste
Télécharger (3,46 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / corolla / template.php @ 64ad485a

1
<?php
2
// Corolla by Adaptivethemes.com
3

    
4
/**
5
 * Override or insert vars into the html template.
6
 */
7
function corolla_preprocess_html(&$vars) {
8
  global $theme_key;
9
  $theme_name = $theme_key;
10

    
11
  // Add a class for the active color scheme
12
  if (module_exists('color')) {
13
    $class = check_plain(get_color_scheme_name($theme_name));
14
    $vars['classes_array'][] = 'color-scheme-' . drupal_html_class($class);
15
  }
16

    
17
  // Add class for the active theme
18
  $vars['classes_array'][] = drupal_html_class($theme_name);
19

    
20
  // Add theme settings classes
21
  $settings_array = array(
22
    'box_shadows',
23
    'body_background',
24
    'menu_bullets',
25
    'content_corner_radius',
26
    'tabs_corner_radius',
27
  );
28
  foreach ($settings_array as $setting) {
29
    $vars['classes_array'][] = at_get_setting($setting);
30
  }
31
}
32

    
33
/**
34
 * Hook into the color module.
35
 */
36
function corolla_process_html(&$vars) {
37
  if (module_exists('color')) {
38
    _color_html_alter($vars);
39
  }
40
}
41
function corolla_process_page(&$vars) {
42
  if (module_exists('color')) {
43
    _color_page_alter($vars);
44
  }
45
}
46

    
47
/**
48
 * Override or insert vars into the block template.
49
 */
50
function corolla_preprocess_block(&$vars) {
51
  if ($vars['block']->module == 'superfish' || $vars['block']->module == 'nice_menu') {
52
    $vars['content_attributes_array']['class'][] = 'clearfix';
53
  }
54
  if ($vars['block']->region == 'menu_bar' || $vars['block']->region == 'header') {
55
    $vars['title_attributes_array']['class'][] = 'element-invisible';
56
  }
57
}
58

    
59

    
60
/**
61
 * Returns HTML for a sort icon.
62
 *
63
 * @param $vars
64
 *   An associative array containing:
65
 *   - style: Set to either 'asc' or 'desc', this determines which icon to show.
66
 */
67
function corolla_tablesort_indicator($vars) {
68
  // Use custom arrow images.
69
  if ($vars['style'] == 'asc') {
70
    return theme('image', array('path' => path_to_theme() . '/css/images/tablesort-ascending.png', 'alt' => t('sort ascending'), 'title' => t('sort ascending')));
71
  }
72
  else {
73
    return theme('image', array('path' => path_to_theme() . '/css/images/tablesort-descending.png', 'alt' => t('sort descending'), 'title' => t('sort descending')));
74
  }
75
}
76

    
77
/**
78
 * Returns HTML for a fieldset form element and its children.
79
 *
80
 * @param $variables
81
 *   An associative array containing:
82
 *   - element: An associative array containing the properties of the element.
83
 *     Properties used: #attributes, #children, #collapsed, #collapsible,
84
 *     #description, #id, #title, #value.
85
 *
86
 * @ingroup themeable
87
 */
88
function corolla_fieldset($vars) {
89

    
90
  $element = $vars['element'];
91
  element_set_attributes($element, array('id'));
92
  _form_set_class($element, array('form-wrapper'));
93

    
94
  $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
95

    
96
  // add a class to the fieldset wrapper if a legend exists, in some instances they do not
97
  $class = "without-legend";
98

    
99
  if (!empty($element['#title'])) {
100

    
101
    // Always wrap fieldset legends in a SPAN for CSS positioning.
102
    $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
103

    
104
    // Add a class to the fieldset wrapper if a legend exists, in some instances they do not
105
    $class = 'with-legend';
106
  }
107

    
108
  $output .= '<div class="fieldset-wrapper ' . $class  . '">';
109

    
110
  if (!empty($element['#description'])) {
111
    $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
112
  }
113

    
114
  $output .= $element['#children'];
115

    
116
  if (isset($element['#value'])) {
117
    $output .= $element['#value'];
118
  }
119

    
120
  $output .= '</div>';
121
  $output .= "</fieldset>\n";
122

    
123
  return $output;
124
}