root / drupal7 / sites / all / themes / bootstrap / templates / system / page.vars.php @ 9525582e
1 |
<?php
|
---|---|
2 |
/**
|
3 |
* @file
|
4 |
* Stub file for "page" theme hook [pre]process functions.
|
5 |
*/
|
6 |
|
7 |
/**
|
8 |
* Pre-processes variables for the "page" theme hook.
|
9 |
*
|
10 |
* See template for list of available variables.
|
11 |
*
|
12 |
* @see page.tpl.php
|
13 |
*
|
14 |
* @ingroup theme_preprocess
|
15 |
*/
|
16 |
function bootstrap_preprocess_page(&$variables) { |
17 |
// Add information about the number of sidebars.
|
18 |
if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { |
19 |
$variables['content_column_class'] = ' class="col-sm-6"'; |
20 |
} |
21 |
elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) { |
22 |
$variables['content_column_class'] = ' class="col-sm-9"'; |
23 |
} |
24 |
else {
|
25 |
$variables['content_column_class'] = ' class="col-sm-12"'; |
26 |
} |
27 |
|
28 |
if (bootstrap_setting('fluid_container') == 1) { |
29 |
$variables['container_class'] = 'container-fluid'; |
30 |
} |
31 |
else {
|
32 |
$variables['container_class'] = 'container'; |
33 |
} |
34 |
|
35 |
$i18n = module_exists('i18n_menu'); |
36 |
|
37 |
// Primary nav.
|
38 |
$variables['primary_nav'] = FALSE; |
39 |
if ($variables['main_menu']) { |
40 |
// Load the tree
|
41 |
$tree = menu_tree_page_data(variable_get('menu_main_links_source', 'main-menu')); |
42 |
|
43 |
// Localize the tree.
|
44 |
if ($i18n) { |
45 |
$tree = i18n_menu_localize_tree($tree); |
46 |
} |
47 |
|
48 |
// Build links.
|
49 |
$variables['primary_nav'] = menu_tree_output($tree); |
50 |
|
51 |
// Provide default theme wrapper function.
|
52 |
$variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary'); |
53 |
} |
54 |
|
55 |
// Secondary nav.
|
56 |
$variables['secondary_nav'] = FALSE; |
57 |
if ($variables['secondary_menu']) { |
58 |
// Load the tree
|
59 |
$tree = menu_tree_page_data(variable_get('menu_secondary_links_source', 'user-menu')); |
60 |
|
61 |
// Localize the tree.
|
62 |
if ($i18n) { |
63 |
$tree = i18n_menu_localize_tree($tree); |
64 |
} |
65 |
|
66 |
// Build links.
|
67 |
$variables['secondary_nav'] = menu_tree_output($tree); |
68 |
|
69 |
// Provide default theme wrapper function.
|
70 |
$variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary'); |
71 |
} |
72 |
|
73 |
$variables['navbar_classes_array'] = array('navbar'); |
74 |
|
75 |
if (bootstrap_setting('navbar_position') !== '') { |
76 |
$variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position'); |
77 |
} |
78 |
elseif (bootstrap_setting('fluid_container') == 1) { |
79 |
$variables['navbar_classes_array'][] = 'container-fluid'; |
80 |
} |
81 |
else {
|
82 |
$variables['navbar_classes_array'][] = 'container'; |
83 |
} |
84 |
if (bootstrap_setting('navbar_inverse')) { |
85 |
$variables['navbar_classes_array'][] = 'navbar-inverse'; |
86 |
} |
87 |
else {
|
88 |
$variables['navbar_classes_array'][] = 'navbar-default'; |
89 |
} |
90 |
} |
91 |
|
92 |
/**
|
93 |
* Processes variables for the "page" theme hook.
|
94 |
*
|
95 |
* See template for list of available variables.
|
96 |
*
|
97 |
* @see page.tpl.php
|
98 |
*
|
99 |
* @ingroup theme_process
|
100 |
*/
|
101 |
function bootstrap_process_page(&$variables) { |
102 |
$variables['navbar_classes'] = implode(' ', $variables['navbar_classes_array']); |
103 |
} |