forked from patrickocoffeyo/BootstrapBlocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
87 lines (77 loc) · 2.35 KB
/
template.php
File metadata and controls
87 lines (77 loc) · 2.35 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
<?php
include('functions/template-functions.php');
/**
* Implimenting hook_process_page()
* Allows you to use node-type based page templates.
*/
function BaseBuildingBlocks_preprocess_page(&$vars) {
global $user;
//Allows you to use node-type, and node ID base page templates
//Adds custom 404 error page template
if (!empty($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->vid;
}
elseif (drupal_get_http_header('status')) {
$vars['theme_hook_suggestions'][] = 'page__404';
}
}
/**
* Implimenting hook_preprocess_html()
* Adds body class for navbar-fixed-top
*/
function BaseBuildingBlocks_preprocess_html(&$vars) {
global $user;
if (theme_get_setting('admin_menu_on_off') == 1 && in_array('administrator', array_values($user->roles))) {
$vars['classes_array'][] = 'fixed-navbar';
}
}
/**
* Implimenting hook_css_alter()
* Turning off some system.css files
*/
function BaseBuildingBlocks_css_alter(&$css) {
// Turn off some styles from the system module
unset($css[drupal_get_path('module', 'system') . '/system.messages.css']);
unset($css[drupal_get_path('module', 'system') . '/system.menus.css']);
}
/**
* Implimenting hook_html_head_alter()
*/
function BaseBuildingBlocks_html_head_alter(&$vars) {
//Change the meta content type to HTML5 content type
$vars['system_meta_content_type']['#attributes'] = array(
'charset' => 'utf-8'
);
//Unsetting the content generator. (Why keep it?)
unset($vars['system_meta_generator']);
//Adding the mobile viewport
$vars['viewport'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'name' => 'viewport',
'content' => 'width=device-width, initial-scale=1.0',
)
);
//If in IE, and chrome frame is available, and theme option says you can use it, USE IT!
$vars['chrome_frame_compatability'] = array(
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => array(
'http-equiv' => 'X-UA-Compatible',
'content' => 'IE=edge,chrome=1',
),
'#access' => theme_get_setting('chrome_frame_on_off'),
);
}
/**
* Implimenting hook_permission()
*/
function BaseBuildingBlocks_permission() {
return array(
'use admin navbar' => array(
'title' => t('Use Administration Navbar'),
),
);
}