root / drupal7 / sites / all / themes / bootstrap / templates / system / page.vars.php @ caf16a48
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 |
// Primary nav.
|
36 |
$variables['primary_nav'] = FALSE; |
37 |
if ($variables['main_menu']) { |
38 |
// Build links.
|
39 |
$variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); |
40 |
// Provide default theme wrapper function.
|
41 |
$variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary'); |
42 |
} |
43 |
|
44 |
// Secondary nav.
|
45 |
$variables['secondary_nav'] = FALSE; |
46 |
if ($variables['secondary_menu']) { |
47 |
// Build links.
|
48 |
$variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu')); |
49 |
// Provide default theme wrapper function.
|
50 |
$variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary'); |
51 |
} |
52 |
|
53 |
$variables['navbar_classes_array'] = array('navbar'); |
54 |
|
55 |
if (bootstrap_setting('navbar_position') !== '') { |
56 |
$variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position'); |
57 |
} |
58 |
elseif(bootstrap_setting('fluid_container') == 1) { |
59 |
$variables['navbar_classes_array'][] = 'container-fluid'; |
60 |
} |
61 |
else {
|
62 |
$variables['navbar_classes_array'][] = 'container'; |
63 |
} |
64 |
if (bootstrap_setting('navbar_inverse')) { |
65 |
$variables['navbar_classes_array'][] = 'navbar-inverse'; |
66 |
} |
67 |
else {
|
68 |
$variables['navbar_classes_array'][] = 'navbar-default'; |
69 |
} |
70 |
} |
71 |
|
72 |
/**
|
73 |
* Processes variables for the "page" theme hook.
|
74 |
*
|
75 |
* See template for list of available variables.
|
76 |
*
|
77 |
* @see page.tpl.php
|
78 |
*
|
79 |
* @ingroup theme_process
|
80 |
*/
|
81 |
function bootstrap_process_page(&$variables) { |
82 |
$variables['navbar_classes'] = implode(' ', $variables['navbar_classes_array']); |
83 |
} |