-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.php
116 lines (109 loc) · 3.64 KB
/
template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* Implements hook_html_head_alter().
* This will overwrite the default meta character type tag with HTML5 version.
*/
function best_responsive_html_head_alter(&$head_elements) {
$head_elements['system_meta_content_type']['#attributes'] = array(
'charset' => 'utf-8'
);
}
/**
* Insert themed breadcrumb page navigation at top of the node content.
*/
function best_responsive_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
// Use CSS to hide titile .element-invisible.
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
// comment below line to hide current page to breadcrumb
$breadcrumb[] = drupal_get_title();
$output .= '<nav class="breadcrumb">' . implode(' » ', $breadcrumb) . '</nav>';
return $output;
}
}
/**
* Override or insert variables into the page template.
*/
function best_responsive_preprocess_page(&$vars) {
if (isset($vars['main_menu'])) {
$vars['main_menu'] = theme('links__system_main_menu', array(
'links' => $vars['main_menu'],
'attributes' => array(
'class' => array('links', 'main-menu', 'clearfix'),
),
'heading' => array(
'text' => t('Main menu'),
'level' => 'h2',
'class' => array('element-invisible'),
)
));
}
else {
$vars['main_menu'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_menu'] = theme('links__system_secondary_menu', array(
'links' => $vars['secondary_menu'],
'attributes' => array(
'class' => array('links', 'secondary-menu', 'clearfix'),
),
'heading' => array(
'text' => t('Secondary menu'),
'level' => 'h2',
'class' => array('element-invisible'),
)
));
}
else {
$vars['secondary_menu'] = FALSE;
}
}
/**
* Duplicate of theme_menu_local_tasks() but adds clearfix to tabs.
*/
function best_responsive_menu_local_tasks(&$variables) {
$output = '';
if (!empty($variables['primary'])) {
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
$variables['primary']['#prefix'] .= '<ul class="tabs primary clearfix">';
$variables['primary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['primary']);
}
if (!empty($variables['secondary'])) {
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
$variables['secondary']['#prefix'] .= '<ul class="tabs secondary clearfix">';
$variables['secondary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['secondary']);
}
return $output;
}
/**
* Override or insert variables into the node template.
*/
function best_responsive_preprocess_node(&$variables) {
$node = $variables['node'];
if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
$variables['classes_array'][] = 'node-full';
}
$variables['date'] = t('!datetime', array('!datetime' => date('j F Y', $variables['created'])));
}
function best_responsive_page_alter($page) {
// <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
$viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1, maximum-scale=1'
)
);
drupal_add_html_head($viewport, 'viewport');
}
/**
* Add javascript files for front-page jquery slideshow.
*/
if (drupal_is_front_page()) {
drupal_add_js(drupal_get_path('theme', 'best_responsive') . '/js/flexslider-min.js');
drupal_add_js(drupal_get_path('theme', 'best_responsive') . '/js/slide.js');
}