Projet

Général

Profil

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

root / drupal7 / sites / all / themes / corporateclean / template.php @ 87dbc3bf

1
<?php
2
/**
3
 * Return a themed breadcrumb trail.
4
 *
5
 * @param $breadcrumb
6
 *   An array containing the breadcrumb links.
7
 * @return
8
 *   A string containing the breadcrumb output.
9
 */
10
function corporateclean_breadcrumb($variables){
11
  $breadcrumb = $variables['breadcrumb'];
12
  $breadcrumb_separator=theme_get_setting('breadcrumb_separator','corporateclean');
13
  
14
  $show_breadcrumb_home = theme_get_setting('breadcrumb_home');
15
  if (!$show_breadcrumb_home) {
16
  array_shift($breadcrumb);
17
  }
18
  
19
  if (!empty($breadcrumb)) {
20
    $breadcrumb[] = drupal_get_title();
21
    return '<div class="breadcrumb">' . implode(' <span class="breadcrumb-separator">' . $breadcrumb_separator . '</span>', $breadcrumb) . '</div>';
22
  }
23
}
24

    
25
function corporateclean_page_alter($page) {
26

    
27
        if (theme_get_setting('responsive_meta','corporateclean')):
28
        $mobileoptimized = array(
29
                '#type' => 'html_tag',
30
                '#tag' => 'meta',
31
                '#attributes' => array(
32
                'name' =>  'MobileOptimized',
33
                'content' =>  'width'
34
                )
35
        );
36

    
37
        $handheldfriendly = array(
38
                '#type' => 'html_tag',
39
                '#tag' => 'meta',
40
                '#attributes' => array(
41
                'name' =>  'HandheldFriendly',
42
                'content' =>  'true'
43
                )
44
        );
45

    
46
        $viewport = array(
47
                '#type' => 'html_tag',
48
                '#tag' => 'meta',
49
                '#attributes' => array(
50
                'name' =>  'viewport',
51
                'content' =>  'width=device-width, initial-scale=1'
52
                )
53
        );
54
        
55
        drupal_add_html_head($mobileoptimized, 'MobileOptimized');
56
        drupal_add_html_head($handheldfriendly, 'HandheldFriendly');
57
        drupal_add_html_head($viewport, 'viewport');
58
        endif;
59
        
60
}
61

    
62
function corporateclean_preprocess_html(&$variables) {
63

    
64
        if (!theme_get_setting('responsive_respond','corporateclean')):
65
        drupal_add_css(path_to_theme() . '/css/basic-layout.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lte IE 8)&(!IEMobile)', '!IE' => FALSE), 'preprocess' => FALSE));
66
        endif;
67
        
68
        drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lte IE 8)&(!IEMobile)', '!IE' => FALSE), 'preprocess' => FALSE));
69
}
70

    
71
/**
72
 * Override or insert variables into the html template.
73
 */
74
function corporateclean_process_html(&$vars) {
75
        // Hook into color.module
76
        if (module_exists('color')) {
77
        _color_html_alter($vars);
78
        }
79

    
80
}
81

    
82
/**
83
 * Override or insert variables into the page template.
84
 */
85
function corporateclean_process_page(&$variables) {
86
  // Hook into color.module.
87
  if (module_exists('color')) {
88
    _color_page_alter($variables);
89
  }
90
 
91
}
92

    
93
function corporateclean_form_alter(&$form, &$form_state, $form_id) {
94
  if ($form_id == 'search_block_form') {
95
  
96
    unset($form['search_block_form']['#title']);
97
        
98
    $form['search_block_form']['#title_display'] = 'invisible';
99
        $form_default = t('Search');
100
    $form['search_block_form']['#default_value'] = $form_default;
101
    $form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/images/search-button.png');
102

    
103
         $form['search_block_form']['#attributes'] = array('onblur' => "if (this.value == '') {this.value = '{$form_default}';}", 'onfocus' => "if (this.value == '{$form_default}') {this.value = '';}" );
104
  }
105
}
106

    
107
/**
108
 * Add javascript files for jquery slideshow.
109
 */
110
if (theme_get_setting('slideshow_js','corporateclean')):
111

    
112
        drupal_add_js(drupal_get_path('theme', 'corporateclean') . '/js/jquery.cycle.all.js');
113
        
114
        //Initialize slideshow using theme settings
115
        $effect=theme_get_setting('slideshow_effect','corporateclean');
116
        $effect_time= (int) theme_get_setting('slideshow_effect_time','corporateclean')*1000;
117
        $slideshow_randomize=theme_get_setting('slideshow_randomize','corporateclean');
118
        $slideshow_wrap=theme_get_setting('slideshow_wrap','corporateclean');
119
        $slideshow_pause=theme_get_setting('slideshow_pause','corporateclean');
120
        
121
        drupal_add_js('jQuery(document).ready(function($) {
122
        
123
        $(window).load(function() {
124
        
125
                $("#slideshow img").show();
126
                $("#slideshow").fadeIn("slow");
127
                $("#slider-controls-wrapper").fadeIn("slow");
128
        
129
                $("#slideshow").cycle({
130
                        fx:    "'.$effect.'",
131
                        speed:  "slow",
132
                        timeout: "'.$effect_time.'",
133
                        random: '.$slideshow_randomize.',
134
                        nowrap: '.$slideshow_wrap.',
135
                        pause: '.$slideshow_pause.',
136
                        pager:  "#slider-navigation",
137
                        pagerAnchorBuilder: function(idx, slide) {
138
                                return "#slider-navigation li:eq(" + (idx) + ") a";
139
                        },
140
                        slideResize: true,
141
                        containerResize: false,
142
                        height: "auto",
143
                        fit: 1,
144
                        before: function(){
145
                                $(this).parent().find(".slider-item.current").removeClass("current");
146
                        },
147
                        after: onAfter
148
                });
149
        });
150
        
151
        function onAfter(curr, next, opts, fwd) {
152
                var $ht = $(this).height();
153
                $(this).parent().height($ht);
154
                $(this).addClass("current");
155
        }
156
        
157
        $(window).load(function() {
158
                var $ht = $(".slider-item.current").height();
159
                $("#slideshow").height($ht);
160
        });
161
        
162
        $(window).resize(function() {
163
                var $ht = $(".slider-item.current").height();
164
                $("#slideshow").height($ht);
165
        });
166
        
167
        });',
168
        array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
169
        );
170

    
171
endif;
172

    
173
?>