/** * Override or insert variables into the page template. */ function burzenski_preprocess_page(&$vars) { $global_config = node_load(98); $node = current_node(); $vars['global_config'] = $global_config; $vars['template_home'] = ''; $vars['header_wrapper_height'] = 'internal'; switch ($node->type) { case 'homepage': $vars['template_home'] = "home.inc"; $vars['shadow_logo'] = '<div id="shadow_logo"></div>'; $vars['header_wrapper_height'] = 'home'; $output = ""; break; case 'page': case 'tax_tip': $vars['header_wrapper_height'] = 'internal'; $output = ""; $vars["page"]["sidebar_left"] = array("#markup" => $output); break; case 'contact_us': $vars['header_wrapper_height'] = 'internal'; $output = ""; break; } /** * Top image on some pages */ if (property_exists($node, "field_top_image")) { if (count($node->field_top_image)) { $vars['top_image'] = file_create_url($node->field_top_image['und'][0]['uri']); } } if (property_exists($node, "field_widget_rotate")) { if (count($node->field_widget_rotate)) { if (count($node->field_widget_rotate['und']) > 1) { $bg = rand(0, count($node->field_widget_rotate['und']) - 1); $vars['field_widget_rotate'] = get_text_widget_rotate($node->field_widget_rotate['und'][$bg]['nid']); } else { $vars['field_widget_rotate'] = get_text_widget_rotate($node->field_widget_rotate['und'][0]['nid']); } } } }
/** * Override or insert variables into the page template. */ function newhaven_preprocess_page(&$vars) { $global_config = node_load(_GLOBAL_CONFIGURATIONS_NODE); $node = current_node(); if (drupal_is_front_page()) { $vars['content_class'] = "homepage"; $output = render($vars["page"]["sidebar_left"]); $output .= '<a class="twitter-timeline" href="https://twitter.com/INFONewHaven" data-widget-id="252952851674955777">Tweets by @INFONewHaven</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> '; $vars["page"]["sidebar_left"] = array("#markup" => $output); } if ($node->type == "page" && !empty($node->field_menu_right) && (is_array($node->field_menu_right['und']) && count($node->field_menu_right['und']) > 0)) { $output_menu = get_bar_right($vars["page"]["sidebar_right"], $node->field_menu_right['und']); $vars["page"]["menu_links_right"] = array("#markup" => $output_menu); } elseif (!empty($vars["page"]["sidebar_right"])) { if ($node->nid == 34689) { $output_menu = render($vars["page"]["sidebar_right"]); } else { $output_menu = "<div class='hidden-xs hidden-sm'>" . render($vars["page"]["sidebar_right"]) . "</div>"; } $vars["page"]["menu_links_right"] = array("#markup" => $output_menu); } /** * Social links on header */ load_socials($global_config, $vars); /** * Top image on some pages */ if (property_exists($node, "field_top_image")) { if (count($node->field_top_image)) { $vars['top_image'] = file_create_url($node->field_top_image['und'][0]['uri']); } } if (property_exists($node, "field_top_flash")) { if (count($node->field_top_flash)) { $vars['top_flash'] = '<div id="flash"></div><script type="text/javascript"> // <![CDATA[ var so1 = new SWFObject("/sites/default/files/' . $node->field_top_flash['und'][0]['filename'] . '", "bl1", "972", "280", "9", "#ffffff"); so1.addVariable("page", "home"); so1.write("flash"); // ]]> </script>'; } } if (property_exists($node, "field_top_head_image")) { if (count($node->field_top_head_image)) { $vars['field_top_head_image'] = "<img src='" . file_create_url($node->field_top_head_image['und'][0]['uri']) . "' />"; } } if (property_exists($node, "field_top_mobile_image")) { if (count($node->field_top_mobile_image)) { $vars['top_mobile_image'] = file_create_url($node->field_top_mobile_image['und'][0]['uri']); } } /** * Slideshow on restaurant week */ if (property_exists($node, "field_top_slideshow") && count($node->field_top_slideshow)) { $vars['top_slideshow'] = create_slideshow($node); $vars['content_class'] = "restaurant"; } /** * Restaurant week bottom logos */ if (property_exists($node, "field_bottom_logos") && count($node->field_bottom_logos)) { $vars['restaurant_logos'] = create_logos($node); } /***** RESPONSIVE ****/ $vars['menu_top'] = menu_tree(variable_get('menu_main_links_source', 'menu-top-menu')); // Create a structured array of the menu to be rendered by drupal_render() $vars['menu_main_footer'] = menu_tree(variable_get('menu_main_links_source', 'main-menu')); // Create a structured array of the menu to be rendered by drupal_render() $vars['menu_main_responsive'] = menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu')); // We get an tree of menu links in an array, in the order they should be rendered foreach ($vars['menu_main_responsive'] as $item) { $item['link']['menu_name'] = 'menu_main_responsive'; } $vars['menu_main_responsive'] = menu_tree_output($vars['menu_main_responsive']); //dsm($vars['menu_main_responsive']); }