-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
125 lines (109 loc) · 3.92 KB
/
template.php
File metadata and controls
125 lines (109 loc) · 3.92 KB
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
117
118
119
120
121
122
123
124
125
<?php
/**
* Implements hook_html_head_alter().
* This will overwrite the default meta character type tag with HTML5 version.
*/
function skeletontheme_html_head_alter(&$head_elements) {
$head_elements['system_meta_content_type']['#attributes'] = array(
'charset' => 'utf-8'
);
}
/**
* Override or insert variables into the page template for HTML output.
*/
function skeletontheme_process_html(&$variables) {
// Hook into color.module.
if (module_exists('color')) {
_color_html_alter($variables);
}
}
/**
* Override or insert variables into the page template.
*/
function skeletontheme_process_page(&$variables) {
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
$variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
if ($variables['hide_site_name']) {
// If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
$variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
}
if ($variables['hide_site_slogan']) {
// If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
$variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
}
// Since the title and the shortcut link are both block level elements,
// positioning them next to each other is much simpler with a wrapper div.
if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
// Add a wrapper div using the title_prefix and title_suffix render elements.
$variables['title_prefix']['shortcut_wrapper'] = array(
'#markup' => '<div class="shortcut-wrapper clearfix">',
'#weight' => 100,
);
$variables['title_suffix']['shortcut_wrapper'] = array(
'#markup' => '</div>',
'#weight' => -99,
);
// Make sure the shortcut link is the first item in title_suffix.
$variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
}
}
function skeletontheme_page_alter($page) {
$mobileoptimized = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'MobileOptimized',
'content' => 'width'
)
);
$handheldfriendly = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'HandheldFriendly',
'content' => 'true'
)
);
$viewport = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1'
)
);
drupal_add_html_head($mobileoptimized, 'MobileOptimized');
drupal_add_html_head($handheldfriendly, 'HandheldFriendly');
drupal_add_html_head($viewport, 'viewport');
}
function skeletontheme_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 .= '<div class="breadcrumb">' . implode('<span class="sep">»</span>', $breadcrumb) . '</div>';
return $output;
}
}
/**
* Add Javascript for responsive mobile menu
*/
if (theme_get_setting('responsive_menu_state')) {
drupal_add_js(drupal_get_path('theme', 'skeletontheme') .'/js/jquery.mobilemenu.js');
$responsive_menu_switchwidth=theme_get_setting('responsive_menu_switchwidth');
$responsive_menu_topoptiontext=theme_get_setting('responsive_menu_topoptiontext');
drupal_add_js('jQuery(document).ready(function($) {
$("#navigation .content > ul").mobileMenu({
prependTo: "#navigation",
combine: false,
switchWidth: '.$responsive_menu_switchwidth.',
topOptionText: "'.$responsive_menu_topoptiontext.'"
});
});',
array('type' => 'inline', 'scope' => 'header'));
}
//EOF:Javascript