| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- /**
- * @file
- * Stub file for "page" theme hook [pre]process functions.
- */
- /**
- * Pre-processes variables for the "page" theme hook.
- *
- * See template for list of available variables.
- *
- * @see page.tpl.php
- *
- * @ingroup theme_preprocess
- */
- function bootstrap_preprocess_page(&$variables) {
- // Add information about the number of sidebars.
- if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
- $variables['content_column_class'] = ' class="col-sm-6"';
- }
- elseif (!empty($variables['page']['sidebar_first']) || !empty($variables['page']['sidebar_second'])) {
- $variables['content_column_class'] = ' class="col-sm-9"';
- }
- else {
- $variables['content_column_class'] = ' class="col-sm-12"';
- }
- if (bootstrap_setting('fluid_container') == 1) {
- $variables['container_class'] = 'container-fluid';
- }
- else {
- $variables['container_class'] = 'container';
- }
- // Primary nav.
- $variables['primary_nav'] = FALSE;
- if ($variables['main_menu']) {
- // Build links.
- $variables['primary_nav'] = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
- // Provide default theme wrapper function.
- $variables['primary_nav']['#theme_wrappers'] = array('menu_tree__primary');
- }
- // Secondary nav.
- $variables['secondary_nav'] = FALSE;
- if ($variables['secondary_menu']) {
- // Build links.
- $variables['secondary_nav'] = menu_tree(variable_get('menu_secondary_links_source', 'user-menu'));
- // Provide default theme wrapper function.
- $variables['secondary_nav']['#theme_wrappers'] = array('menu_tree__secondary');
- }
- $variables['navbar_classes_array'] = array('navbar');
- if (bootstrap_setting('navbar_position') !== '') {
- $variables['navbar_classes_array'][] = 'navbar-' . bootstrap_setting('navbar_position');
- }
- elseif (bootstrap_setting('fluid_container') == 1) {
- $variables['navbar_classes_array'][] = 'container-fluid';
- }
- else {
- $variables['navbar_classes_array'][] = 'container';
- }
- if (bootstrap_setting('navbar_inverse')) {
- $variables['navbar_classes_array'][] = 'navbar-inverse';
- }
- else {
- $variables['navbar_classes_array'][] = 'navbar-default';
- }
- }
- /**
- * Processes variables for the "page" theme hook.
- *
- * See template for list of available variables.
- *
- * @see page.tpl.php
- *
- * @ingroup theme_process
- */
- function bootstrap_process_page(&$variables) {
- $variables['navbar_classes'] = implode(' ', $variables['navbar_classes_array']);
- }
|