root / drupal7 / sites / all / themes / blogbuzz / template.php @ 4b706e38
1 |
<?php
|
---|---|
2 |
// $Id: template.php,v 1.3.2.1 2011/01/23 05:03:13 antsin Exp $
|
3 |
|
4 |
/*
|
5 |
+----------------------------------------------------------------+
|
6 |
| BlogBuzz for Dupal 7.x - Version 1.0 |
|
7 |
| Copyright (C) 2011 Antsin.com All Rights Reserved. |
|
8 |
| @license - GNU GENERAL PUBLIC LICENSE |
|
9 |
|----------------------------------------------------------------|
|
10 |
| Theme Name: BlogBuzz |
|
11 |
| Description: BlogBuzz by Antsin |
|
12 |
| Author: Antsin.com |
|
13 |
| Website: http://www.antsin.com/ |
|
14 |
|----------------------------------------------------------------+
|
15 |
*/
|
16 |
|
17 |
/**
|
18 |
* HTML preprocessing
|
19 |
*/
|
20 |
function blogbuzz_preprocess_html(&$vars) { |
21 |
|
22 |
function get_blogbuzz_style() { |
23 |
$style = theme_get_setting('style'); |
24 |
return $style; |
25 |
} |
26 |
|
27 |
drupal_add_css(drupal_get_path('theme','blogbuzz') . '/css/' . get_blogbuzz_style() . '.css', array('group' => CSS_THEME, 'every_page' => TRUE)); |
28 |
// Add conditional stylesheets for IE
|
29 |
drupal_add_css(path_to_theme() . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); |
30 |
drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE)); |
31 |
} |
32 |
|
33 |
/**
|
34 |
* Override or insert variables into the page template.
|
35 |
*/
|
36 |
function blogbuzz_process_page(&$vars) { |
37 |
|
38 |
if (isset($vars['main_menu'])) { |
39 |
$vars['primary_nav'] = theme('links__system_main_menu', array( |
40 |
'links' => $vars['main_menu'], |
41 |
'attributes' => array( |
42 |
'class' => array('links', 'inline', 'main-menu'), |
43 |
), |
44 |
'heading' => array( |
45 |
'text' => t('Main menu'), |
46 |
'level' => 'h2', |
47 |
'class' => array('element-invisible'), |
48 |
) |
49 |
)); |
50 |
} |
51 |
else {
|
52 |
$vars['primary_nav'] = FALSE; |
53 |
} |
54 |
if (isset($vars['secondary_menu'])) { |
55 |
$vars['secondary_nav'] = theme('links__system_secondary_menu', array( |
56 |
'links' => $vars['secondary_menu'], |
57 |
'attributes' => array( |
58 |
'class' => array('links', 'inline', 'secondary-menu'), |
59 |
), |
60 |
'heading' => array( |
61 |
'text' => t('Secondary menu'), |
62 |
'level' => 'h2', |
63 |
'class' => array('element-invisible'), |
64 |
) |
65 |
)); |
66 |
} |
67 |
else {
|
68 |
$vars['secondary_nav'] = FALSE; |
69 |
} |
70 |
} |
71 |
|
72 |
/**
|
73 |
* Override or insert variables into the node template.
|
74 |
*/
|
75 |
function blogbuzz_preprocess_node(&$vars) { |
76 |
|
77 |
if ($vars['view_mode'] != 'full' && $vars['id'] == 1) { |
78 |
$vars['classes_array'][] = 'node-first'; |
79 |
} |
80 |
|
81 |
if ($vars['view_mode'] == 'full' && node_is_page($vars['node'])) { |
82 |
$vars['classes_array'][] = 'node-full'; |
83 |
} |
84 |
} |
85 |
|
86 |
/**
|
87 |
* Implements theme_menu_tree().
|
88 |
*/
|
89 |
function blogbuzz_menu_tree($vars) { |
90 |
return '<ul class="menu clearfix">' . $vars['tree'] . '</ul>'; |
91 |
} |
92 |
|
93 |
function blogbuzz_button($vars) { |
94 |
$element = $vars['element']; |
95 |
$element['#attributes']['type'] = 'submit'; |
96 |
element_set_attributes($element, array('id', 'name', 'value')); |
97 |
|
98 |
$element['#attributes']['class'][] = 'form-' . $element['#button_type']; |
99 |
if (!empty($element['#attributes']['disabled'])) { |
100 |
$element['#attributes']['class'][] = 'form-button-disabled'; |
101 |
} |
102 |
return '<span class="button"><input' . drupal_attributes($element['#attributes']) . ' /></span>'; |
103 |
} |