/** * Preprocessor for theme('page'). */ function cube_preprocess_page(&$vars) { // Automatically adjust layout for page with right sidebar content if no // explicit layout has been set. $layout = module_exists('context_layouts') ? context_layouts_get_active_layout() : NULL; if (arg(0) != 'admin' && !empty($vars['page']['right']) && (!$layout || $layout['layout'] == 'default')) { $vars['theme_hook_suggestion'] = 'page__context_layouts_cube_columns'; drupal_add_css(drupal_get_path('theme', 'cube') . '/layout-sidebar.css'); } // Clear out help text if empty. if (empty($vars['help']) || !strip_tags($vars['help'])) { $vars['help'] = ''; } // Help text toggler link. $vars['help_toggler'] = l(t('Help'), $_GET['q'], array('attributes' => array('id' => 'help-toggler', 'class' => array('toggler')), 'fragment' => 'help-text')); // Overlay is enabled. $vars['overlay'] = module_exists('overlay') && overlay_get_mode() === 'child'; if ($vars['overlay']) { } // Display user links $vars['user_links'] = _cube_user_links(); // Display tabs $vars['primary_tabs'] = menu_primary_local_tasks(); $vars['secondary_tabs'] = menu_secondary_local_tasks(); }
/** * Preprocessor for theme('page'). */ function cube_preprocess_page(&$vars) { // Automatically adjust layout for page with right sidebar content if no // explicit layout has been set. $layout = module_exists('context_layouts') ? context_layouts_get_active_layout() : NULL; if (arg(0) != 'admin' && !empty($vars['right']) && !$layout) { $vars['template_files'][] = 'layout-sidebar'; $css = array('screen' => array('theme' => array(drupal_get_path('theme', 'cube') . '/layout-sidebar.css' => TRUE))); $vars['styles'] .= drupal_get_css($css); } }
function themekit_preprocess_html(&$variables) { //if context_layouts module exist, append active layout class to body if (module_exists('context_layouts') && ($layout = context_layouts_get_active_layout())) { $variables['classes_array'][] = drupal_html_class('layout-' . $layout['layout']); } $html5_respond_meta = theme_get_setting('zen_html5_respond_meta'); // Add selectivizr.js based on theme settings. if (isset($html5_respond_meta['selectivizr']) && $html5_respond_meta['selectivizr']) { drupal_add_js(drupal_get_path('theme', 'themekit') . '/js/selectivizr-min.js', array('group' => JS_THEME)); } // Set js and css paths. $js_path = drupal_get_path('theme', 'themekit') . '/js/'; $css_path = drupal_get_path('theme', 'themekit') . '/css/'; themekit_add_assets($js_path, $css_path, array('js_filename' => 'theme.js', 'js_filename_min' => 'theme.min.js', 'css_filename' => 'style.css')); }
/** * Retrieves the name of the currently active layout. */ function doune_active_layout() { static $layout; // determine the layout if (!isset($layout)) { $layout = 'default'; if (module_exists('context_layouts') && ($layout_info = context_layouts_get_active_layout())) { $layout = $layout_info['layout']; } } return $layout; }
/** * Preprocessor for theme('page'). */ function afg_preprocess_page(&$vars) { global $user; // dpm(get_defined_vars()); // if we are displaying a node and the node has dashboard show that instead $arg0 = arg(0); $arg1 = arg(1); $arg2 = arg(2); // dpm($arg0, 'arg0'); // dpm($arg1, 'arg1'); // dpm($arg2, 'arg2'); if (!$vars['is_front'] && empty($arg2) && $arg0 == 'node') { $node = node_load($arg1); if ($node && in_array($node->type, array('group_app_team','group_centre_school'))) { $og = og_get_group_context(); drupal_goto($og->purl); } } // Override default error message and prompt login _afg_override_login_message($vars); // Show login message on shoutbox form page for anonymous users if ($arg0 == 'commentwall' || $arg0 == 'shoutbox') { if (!$user->uid) { $m = '<a href="user/login?destination='. $arg0 .'">Login</a>' . ' or <a href="user/register?destination='. $arg0 .'">register</a>' . ' to post comments</span>'; _afg_show_message($vars, $m, FALSE); } } // Rewrite taxonomy term heading if ($arg0 == 'taxonomy' && $arg1 == 'term') { $title = $vars['title']; if (substr($title, 0, 6) === 'Tagged') { $term = ucwords(str_replace('"', '', trim(substr($title, 6)))); $vars['title'] = 'Tagged: <span class="term">'. $term .'</span>'; } } // Force using the correct template file if(count($vars['template_files']) > 1) { foreach($vars['template_files'] as $key => $template) { if(strcasecmp($template, 'page') === 0) { unset($vars['template_files'][$key]); break; } } } // If frontpage use page front template if(drupal_is_front_page()) { $vars['template_files'] = array('page-front'); } // Automatically adjust layout for page with right sidebar content if no // explicit layout has been set. $layout = module_exists('context_layouts') ? context_layouts_get_active_layout() : NULL; if (arg(0) != 'admin' && !empty($vars['right']) && !$layout) { $vars['template_files'][] = 'layout-sidebar'; $css = array('screen' => array('theme' => array(drupal_get_path('theme', 'cube') . '/layout-sidebar.css' => TRUE))); $vars['styles'] .= drupal_get_css($css); } // Admin form template //if (arg(0) != 'admin' && empty($vars['right']) && $vars['template_files'][] = 'page-node') { //aray_unshift($vars['template_files'], 'page-admin-form'); //$vars['template_files'][] = 'page-admin-form'; //dpm('a'); //} //dpm($vars, vars); // Header menu links $links = menu_navigation_links('menu-header-menu', 0); //$uri = $_SERVER['REQUEST_URI']; //$curr_path = substr($uri, strpos($uri, '/') + 1); //$trail = menu_get_active_trail(); //$trail_path = $trail[1]['path']; $path = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; foreach ($links as $key => $link){ // Add active state class $classes = (strcmp($path, $link['href']) == 0) ? ' header-menu-active' : ''; // Apply classes $links[$key]['attributes']['class'] .= ' header-menu-' . strtolower($links[$key]['title']); $links[$key]['attributes']['class'] .= $classes; } $vars['header_links'] = $links; $vars['logo'] = base_path() . path_to_theme() . '/images/afg/logo.png'; // Set page title to group name $og = og_get_group_context(); if ($og) { $nid = $og->nid; $group_node = node_load($nid); } if ($group_node) { $vars['title'] = $group_node->title; $vars['header_desc'] = $group_node->body; /**website variable not in use in page.tpl**/ // if ($node->type == 'group_centre_school') { // $website = $node->field_website[0]['url']; // } // $vars['website'] = $website; //get region from taxonomy for group node if ($group_node->type == 'group_centre_school') { $q = 'select name from {term_node} tn inner join {term_data} td on tn.tid=td.tid where nid = %d and tn.vid = %d and td.vid = %d'; $nid = $group_node->nid; $vid = $group_node->vid; $res = db_query($q, $nid, $vid, 9); $region = db_result($res); } $vars['region'] = $region; $vars['city'] = $group_node->field_centre_loc_details[0]['city']; } //Get vars for user $profile_node = content_profile_load('profile', $arg1); if($profile_node) { $vars['title'] = $profile_node->title; if ($profile_node->picture) { $user_pic_path = $profile_node->picture; } else { $user_pic_path = 'sites/all/themes/rubik/afg/images/afg/icons/afg_profile-icon.gif'; } $vars['user_pic'] = theme('imagecache', 'user-m', $user_pic_path); //dpm($profile_node, 'profile'); //dpm(user_load($arg1), 'user'); //is_profile_flag for rendering social links $vars['is_profile'] = TRUE; } // Rewrite the page titles to remove the Home if (strpos($vars['head_title'], 'Home') === 0) { $og = og_get_group_context(); $title = $og->title; if (!empty($title)) { $vars['head_title'] = str_replace('Home', $title, $vars['head_title']); } } }