/** * Implementation of THEMEHOOK_settings() function. * * @param $saved_settings * array An array of saved settings for this theme. * @return * array A form array. */ function phptemplate_settings($saved_settings) { // Empty the cached css... cache_clear_all('abessive_custom_css', 'cache'); $form = array(); require_once path_to_theme() . '/abessive_settings.php'; // Add Farbtastic color picker drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE); drupal_add_js('misc/farbtastic/farbtastic.js'); drupal_add_js(path_to_theme() . '/theme-settings.js'); $defaults = _abessive_default_settings(); $settings = array_merge($defaults, $saved_settings); $form['abessive_picker'] = array('#type' => 'markup', '#value' => '<div id="picker"></div>'); $form['abessive_background_color'] = array('#type' => 'textfield', '#title' => t('Background Color'), '#description' => t('What colour should the body background behind all the containers be? Default: %val', array('%val' => $defaults['abessive_background_color'])), '#default_value' => $settings['abessive_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_border_color'] = array('#type' => 'textfield', '#title' => t('Border Color'), '#description' => t('What colour should the border around all the containers be? Default: %val', array('%val' => $defaults['abessive_border_color'])), '#default_value' => $settings['abessive_border_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_content_background_color'] = array('#type' => 'textfield', '#title' => t('Content Background Color'), '#description' => t('What colour should the background of all the containers be? Default: %val', array('%val' => $defaults['abessive_content_background_color'])), '#default_value' => $settings['abessive_content_background_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field', 'abessive_calculate_gradient')); $form['abessive_content_background_color']['abessive_r5'] = $form['abessive_content_background_color']['abessive_r4'] = $form['abessive_content_background_color']['abessive_r3'] = $form['abessive_content_background_color']['abessive_r2'] = array('#type' => 'value', '#default_value' => 0); $form['abessive_text_color'] = array('#type' => 'textfield', '#title' => t('Text Color'), '#description' => t('What colour should the text be? Default: %val', array('%val' => $defaults['abessive_text_color'])), '#default_value' => $settings['abessive_text_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_link_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Color'), '#description' => t('What colour should hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_color'])), '#default_value' => $settings['abessive_link_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_link_hover_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Hover Color'), '#description' => t('What colour should hyperlinks be when hovered over? Default: %val', array('%val' => $defaults['abessive_link_hover_color'])), '#default_value' => $settings['abessive_link_hover_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_link_active_color'] = array('#type' => 'textfield', '#title' => t('Hyperlink Active Color'), '#description' => t('What colour should active hyperlinks be? Default: %val', array('%val' => $defaults['abessive_link_active_color'])), '#default_value' => $settings['abessive_link_active_color'], '#size' => 7, '#maxlength' => 7, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#attributes' => array('class' => 'form-item-use-colorpicker'), '#element_validate' => array('abessive_validate_hex_field')); $form['abessive_left_width'] = array('#type' => 'textfield', '#title' => t('Left Column Width'), '#description' => t('How wide should the left column be? Default: %val', array('%val' => $defaults['abessive_left_width'])), '#default_value' => $settings['abessive_left_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field')); $form['abessive_right_width'] = array('#type' => 'textfield', '#title' => t('Right Column Width'), '#description' => t('How wide should the right column be? Default: %val', array('%val' => $defaults['abessive_right_width'])), '#default_value' => $settings['abessive_right_width'], '#size' => 3, '#maxlength' => 3, '#prefix' => '<div class="container-inline">', '#suffix' => '</div>', '#field_suffix' => 'px', '#element_validate' => array('abessive_validate_numeric_field')); $form['#submit'][] = 'abessive_submit_settings'; return $form; }
/** * Builds inner content, then hands off to layout-specified theme function for * final render step. * * This is the outermost method in the Panels render pipeline. It calls the * inner methods, which return a content array, which is in turn passed to the * theme function specified in the layout plugin. * * @return string * Themed & rendered HTML output. */ function render() { if (!empty($this->plugins['layout']['css'])) { if (file_exists(path_to_theme() . '/' . $this->plugins['layout']['css'])) { drupal_add_css(path_to_theme() . '/' . $this->plugins['layout']['css']); } else { drupal_add_css($this->plugins['layout']['path'] . '/' . $this->plugins['layout']['css']); } } // This now comes after the CSS is added, because panels-within-panels must // have their CSS added in the right order; inner content before outer content. if (empty($this->display->cache['method']) || !empty($this->display->skip_cache)) { $content = $this->render_regions(); } else { $cache = panels_get_cached_content($this->display, $this->display->args, $this->display->context); if ($cache === FALSE) { $cache = new panels_cache_object(); $cache->set_content($this->render_regions()); panels_set_cached_content($cache, $this->display, $this->display->args, $this->display->context); } $content = $cache->content; } $output = theme($this->plugins['layout']['theme'], check_plain($this->display->css_id), $content, $this->display->layout_settings, $this->display, $this->plugins['layout'], $this); return $output; }
function pluralsite_preprocess_page(&$variables, $hook) { $slogans = array(t('This is a new slogan 1'), t('This is a new slogan 2'), t('This is a new slogan 3'), t('This is a new slogan 4'), t('This is a new slogan 5'), t('This is a new slogan 6'), t('This is a new slogan 7'), t('This is a new slogan 8')); $slogan = $slogans[array_rand($slogans)]; $variables['site_slogan'] = $slogan; // $use_twitter = theme_get_setting('use_twitter'); // if ($use_twitter) { // if ($cache = cache_get('pluralsite_tweets')) { // $data = $cache -> $data; // } else { // $query = theme_get_setting('twitter_search_term'); // $query = drupal_encode_path($query); // $response = drupal_http_request('https://twitter.com/search?q=' . $query); // aerosmith&src=typd // if ($response -> code == 200) { // $data = json_decode($response->data); // cache_set('pluralsite_tweets', $data, 'cache', 300); // } // } // $tweet = $data->results[array_rand($data->results)]; // $variables['site_slogan'] = check_plain(html_entity_decode($tweet -> text)); // } // Add new variables to page.tpl for footer if ($variables['logged_in']) { $variables['footer_message'] = t('Welcome @username, Lullabot love\'s you.', array('@username' => $variables['user']->name)); } else { $variables['footer_message'] = t('Lullabot loves you'); } // add css to front page if ($variables['is_front'] === TRUE) { drupal_add_css(path_to_theme() . '/css/front.css', array('group' => CSS_THEME, 'weight' => 10)); } }
/** * Build the code files. */ function collectFiles(&$files) { $theme_registry = theme_get_registry(); // Our theme base was set in our incoming component data. $theme_base = $this->base_component->component_data['theme_hook_bases'][$this->name]; $theme_info = $theme_registry[$theme_base]; //drush_print_r($this); //drush_print_r($theme_info); // Get the original TPL file we want to copy. // Due to how the theme registry works, this will be one of: // - the original file from the module // - an overridden tpl file in the current theme (eg, if you request // node--article, and your theme has node.tpl, then you get that) // - an overridden tpl file in a parent theme, same principle. $original_tpl_file = $theme_info['path'] . '/' . $theme_info['template'] . '.tpl.php'; $tpl_code = file_get_contents($original_tpl_file); //print $tpl_code; $theme_path = path_to_theme(); // Try a 'templates' folder inside it. if (file_exists($theme_path . '/templates')) { $file_path .= 'templates'; } else { $file_path = ''; } $files['info'] = array('path' => $file_path, 'filename' => $this->name . '.tpl.php', 'body' => array($tpl_code)); }
/** * Implements hook_preprocess_html */ function msd15_preprocess_html(&$vars) { drupal_add_css('https://uom-design-system.s3.amazonaws.com/v1.0/uom.css', 'external'); drupal_add_css(path_to_theme() . '/css/style.css'); drupal_add_js('https://uom-design-system.s3.amazonaws.com/v1.0/uom.js', 'external'); drupal_add_js(path_to_theme() . '/js/main.js', array('scope' => 'footer')); }
/** * Preprocess variables for html.tpl.php */ function bootstrap_business_preprocess_html(&$variables) { /** * Add IE8 Support */ drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lt IE 9)', '!IE' => FALSE), 'preprocess' => FALSE)); drupal_add_css(path_to_theme() . '/css/bootstrap.min.css'); drupal_add_css(path_to_theme() . '/css/print.css', array('media' => 'print')); /** * Add Javascript for enable/disable scrollTop action */ if (theme_get_setting('scrolltop_display', 'bootstrap_business')) { drupal_add_js('jQuery(document).ready(function($) { $(window).scroll(function() { if($(this).scrollTop() != 0) { $("#toTop").fadeIn(); } else { $("#toTop").fadeOut(); } }); $("#toTop").click(function() { $("body,html").animate({scrollTop:0},800); }); });', array('type' => 'inline', 'scope' => 'header')); } if (arg(0) == 'employers' && arg(1) == "") { $variables['classes_array'][] = 'companies'; } //EOF:Javascript }
/** * Render a template. * @param $name The template name. * @param $vars An array mapping template variable names to their values. If * the value is a string, it will be treated as a path. */ function template_render($name, $vars = array()) { // Run default preprocess hook $vars = array_merge($vars, template_preprocess($vars)); // TODO run module preprocess hooks // Run default preprocess hook for template $generator = 'template_preprocess_' . $name; if (function_exists($generator)) { $vars = array_merge($vars, call_user_func($generator, $vars)); } // TODO run page-specific module preprocess hooks extract($vars); // Render template if (isset($vars['type'])) { $filename = path_to_theme() . '/' . "{$name}-{$vars['type']}" . '.tpl.php'; } else { // TODO This should be a fallback, not an else -Ed 2013-01-29 $filename = path_to_theme() . '/' . $name . '.tpl.php'; } ob_start(); include $filename; $output = ob_get_contents(); ob_end_clean(); return $output; }
/** * Override or insert variables into the page template. */ function seven_preprocess_page(&$vars) { $vars['primary_local_tasks'] = menu_primary_local_tasks(); $vars['secondary_local_tasks'] = menu_secondary_local_tasks(); $vars['ie_styles'] = '<!--[if lt IE 7]><style type="text/css" media="screen">@import ' . path_to_theme() . '/ie6.css";</style><![endif]-->'; $vars['back_to_site'] = l(t('Back to the front page'), ''); }
function velocity_preprocess_html(&$vars) { $file = 'color-' . theme_get_setting('theme_color') . '-style.css'; drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 115, 'browsers' => array(), 'preprocess' => FALSE)); $file = theme_get_setting('theme_layout') . '-style.css'; drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 116, 'browsers' => array(), 'preprocess' => FALSE)); drupal_add_js('jQuery(document).ready(function($) { $(window).scroll(function() { if($(this).scrollTop() != 0) { $("#toTop").fadeIn(); } else { $("#toTop").fadeOut(); } }); $("#toTop").click(function() { $("body,html").animate({scrollTop:0},800); }); });', array('type' => 'inline', 'scope' => 'header')); drupal_add_library('system', 'ui.accordion'); drupal_add_library('system', 'ui.tabs'); drupal_add_library('system', 'ui.progressbar'); drupal_add_js(drupal_get_path('module', 'your_module_name') . '/exposedfilterquick.js', 'module'); }
/** * Implements hook_preprocess_page(). */ function eu_projects_theme_preprocess_page(&$vars, $hook) { $path_alias = drupal_get_path_alias(); // Webtools. $inline_script = '<script defer src="//europa.eu/webtools/load.js" type="text/javascript"></script>'; $element = array('#type' => 'markup', '#markup' => $inline_script); drupal_add_html_head($element, 'webtools'); // Apple-touch-icon-precomposed. $apple_touch_icon_precomposed = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'apple-touch-icon-precomposed')); drupal_add_html_head($apple_touch_icon_precomposed, 'apple-touch-icon-precomposed'); // Apple-touch-icon. $apple_touch_icon = array('#tag' => 'link', '#attributes' => array('href' => file_create_url(path_to_theme() . '/images/apple-touch-icon.png'), 'rel' => 'icon')); drupal_add_html_head($apple_touch_icon, 'apple-touch-icon'); // Apple-mobile-web-app-capable. $apple_mobile_web_app_capable = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-capable', 'content' => 'yes')); drupal_add_html_head($apple_mobile_web_app_capable, 'apple-mobile-web-app-capable'); // Application-name. $application_name = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => t('EU Results'))); drupal_add_html_head($application_name, 'application-name'); // Apple-mobile-web-app-title. $apple_mobile_web_app_title = array('#tag' => 'meta', '#attributes' => array('name' => 'apple-mobile-web-app-title', 'content' => t('EU Results'))); drupal_add_html_head($apple_mobile_web_app_title, 'apple-mobile-web-app-title'); // Apple-touch-startup-image-ec. $apple_touch_startup_image_ec = array('#tag' => 'meta', '#attributes' => array('rel' => 'apple-touch-startup-image-ec', 'href' => file_create_url(path_to_theme() . '/images/startup-image.png'))); drupal_add_html_head($apple_touch_startup_image_ec, 'apple-touch-startup-image-ec'); // Preload geojson for map if ($path_alias == 'search-projects') { $path = explode('?', request_uri()); $var = isset($path[1]) ? '?' . $path[1] : ''; $preload_geojson = array('#tag' => 'link', '#attributes' => array('rel' => 'prefetch', 'href' => $GLOBALS['base_url'] . '/projects-geojson_' . $GLOBALS['language']->language . $var)); drupal_add_html_head($preload_geojson, 'preload_geojson'); } }
/** * Implements hook_preproces_html(). */ function cmstheme_preprocess_html(&$variables) { $theme_path = path_to_theme(); drupal_add_js($theme_path . '/js/script.js'); drupal_add_js($theme_path . '/js/jquery.phonenumber.js'); drupal_add_js($theme_path . '/js/jquery.dagsorden.js', array('scope' => 'footer', 'weight' => 5)); }
/** * Override or insert variables into the html template. */ function corkedscrewer_preprocess_html(&$variables) { if (!theme_get_setting('responsive_respond', 'corkedscrewer')) { drupal_add_css(path_to_theme() . '/css/basic-layout.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lte IE 8)&(!IEMobile)', '!IE' => FALSE), 'preprocess' => FALSE)); } drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('!IE' => FALSE), 'preprocess' => FALSE)); }
/** * Preprocess variables for html.tpl.php */ function bootstrap_business_preprocess_html(&$variables) { /** * Add IE8 Support */ drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => '(lt IE 9)', '!IE' => FALSE), 'preprocess' => FALSE)); /** * Add Javascript for enable/disable Bootstrap 3 Javascript */ if (theme_get_setting('bootstrap_js_include', 'bootstrap_business')) { drupal_add_js(drupal_get_path('theme', 'bootstrap_business') . '/bootstrap/js/bootstrap.min.js'); } //EOF:Javascript /** * Add Javascript for enable/disable scrollTop action */ if (theme_get_setting('scrolltop_display', 'bootstrap_business')) { drupal_add_js('jQuery(document).ready(function($) { $(window).scroll(function() { if($(this).scrollTop() != 0) { $("#toTop").fadeIn(); } else { $("#toTop").fadeOut(); } }); $("#toTop").click(function() { $("body,html").animate({scrollTop:0},800); }); });', array('type' => 'inline', 'scope' => 'header')); } //EOF:Javascript }
/** * Implements template_preprocess(). */ function theme1014_preprocess(&$vars, $hook) { $vars['theme1014_path'] = base_path() . path_to_theme(); $count[$hook] = isset($count[$hook]) && is_int($count[$hook]) ? $count[$hook] : 1; $vars['zebra_hook'][$hook] = $count[$hook] % 2 ? 'odd' : 'even'; $vars['id_hook'][$hook] = $count[$hook]++; }
/** * Implements theme_process_page(). */ function basetpl_process_page(&$variables) { global $base_path; // show/hide breadcrumb $variables['show_breadcrumb'] = TRUE; // var theme_path $variables['theme_path'] = $base_path . path_to_theme(); // var site_info $variables['site_info'] = $variables['logo'] || $variables['site_name'] || $variables['site_slogan'] ? TRUE : FALSE; // check if page is system page $variables['system_page'] = isset($variables['node']) ? FALSE : TRUE; // backend if (user_is_logged_in() && path_is_admin(current_path())) { $variables['site_info'] = FALSE; $variables['system_page'] = TRUE; foreach (element_children($variables['page']) as $region) { if ($region != 'content') { $variables['page'][$region] = FALSE; } } } // show/hide page title $variables['title'] = $variables['system_page'] ? $variables['title'] : FALSE; // add robots to head if (theme_get_setting('robots') == 1) { $robots = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex,nofollow')); drupal_add_html_head($robots, 'robots'); } }
public function run() { $explodedpath = explode("/", current_path()); $event_id = $this->clearContent($explodedpath[1]); $resultEvent = $this->event->getEvents(array('EID' => $event_id), 'complete'); $resultEvent = $resultEvent[$event_id]; $this->isOwner = $this->event->isAuthorized($event_id); if (empty($resultEvent)) { // Event nicht vorhanden if (session_status() == PHP_SESSION_NONE) { session_start(); } drupal_set_message(t('Dieses Event konnte nicht gefunden werden...')); header("Location: " . $base_url . "/events"); } $showMap = false; if (!empty($resultEvent->adresse->gps_lat)) { $showMap = true; $koordinaten = $resultEvent->adresse->gps_lat . ',' . $resultEvent->adresse->gps_long; $this->addMapContent($koordinaten, array('gps' => $koordinaten, 'name' => $resultEvent->name, 'strasse' => $resultEvent->adresse->strasse, 'nr' => $resultEvent->adresse->nr)); } ob_start(); // Aktiviert "Render"-modus include_once path_to_theme() . '/templates/eventprofil.tpl.php'; return ob_get_clean(); // Übergabe des gerenderten "eventprofil.tpl.php" }
public static function image($source, $alt = '', $title = '', array $attributes = array(), array $options = array()) { $default_options = array('type' => 'theme'); $options = array_replace_recursive($default_options, $options); $variables = array(); switch ($options['type']) { case 'theme': $variables['path'] = path_to_theme() . '/' . $source; break; default: $variables['path'] = $source; } if ($alt) { $variables['alt'] = $alt; } if ($title) { $variables['title'] = $title; } if (count($attributes) > 0) { if (array_key_exists('width', $attributes)) { $variables['width'] = $attributes['width']; unset($attributes['width']); } if (array_key_exists('height', $attributes)) { $variables['height'] = $attributes['height']; unset($attributes['height']); } $variables['attributes'] = $attributes; } return theme('image', $variables); }
function drupify_breadcrumb($breadcrumb) { if (!empty($breadcrumb)) { $bcimage = ' <img src="' . base_path() . path_to_theme() . '/images/arrow.png"> '; return '<div class="breadcrumb">' . implode($bcimage, $breadcrumb) . '</div>'; } }
function intranet_preprocess_html(&$variables) { drupal_add_css(base_path() . path_to_theme() . '/styles/style.css', array('type' => 'external')); drupal_add_css(base_path() . path_to_theme() . '/styles/icons.css', array('type' => 'external')); drupal_add_css(base_path() . path_to_theme() . '/styles/animate.css', array('type' => 'external')); drupal_add_css(base_path() . path_to_theme() . '/styles/responsive.css', array('type' => 'external')); /*$styling = theme_get_setting('styling', 'intranet'); if ($styling == 'rtl') drupal_add_css(base_path() . path_to_theme() . '/styles/rtl.css', array('type' => 'external')); //Version background $version = theme_get_setting('version_c', 'intranet'); if ($version == 'dark') drupal_add_css(base_path() . path_to_theme() . '/styles/dark.css', array('type' => 'external')); */ drupal_add_css(base_path() . path_to_theme() . '/styles/update.css', array('type' => 'external')); drupal_add_js(base_path() . path_to_theme() . '/js/intranet.js', array('type' => 'file', 'scope' => 'footer')); drupal_add_js(base_path() . path_to_theme() . '/js/jquery.ticker.js', array('type' => 'file', 'scope' => 'header')); drupal_add_js(base_path() . path_to_theme() . '/js/custom.js', array('type' => 'file', 'scope' => 'footer')); /* $disable_switcher = theme_get_setting('intranet_disable_switch', 'intranet'); if (empty($disable_switcher)) $disable_switcher = 'on'; if (!empty($disable_switcher) && $disable_switcher == 'on') { //Style drupal_add_js(base_path() . path_to_theme() . '/customizer/script.js', array('type' => 'file', 'scope' => 'footer')); drupal_add_css(base_path() . path_to_theme() . '/customizer/style.css', array('type' => 'external')); //End style } */ drupal_add_js(base_path() . path_to_theme() . '/js/update.js', array('type' => 'file', 'scope' => 'footer')); //included file validation js function include_file_validation_js_function(); }
/** * Implements hook_preprocess_html */ function checkbook3_preprocess_html(&$vars) { drupal_add_library('system', 'ui'); drupal_add_css(path_to_theme() . '/css/ie-7.css', array('group' => CSS_THEME, 'weight' => 997, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE))); drupal_add_css(path_to_theme() . '/css/ie-8.css', array('group' => CSS_THEME, 'weight' => 998, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE))); drupal_add_css(path_to_theme() . '/css/ie-9.css', array('group' => CSS_THEME, 'weight' => 999, 'browsers' => array('IE' => 'IE 9', '!IE' => FALSE))); }
/** * Implements hook_preproces_html(). */ function os2web_core_theme_preprocess_html(&$variables) { $theme_path = path_to_theme(); drupal_add_js($theme_path . '/js/script.js'); drupal_add_js($theme_path . '/js/jquery.phonenumber.js'); drupal_add_js($theme_path . '/js/os2web_menus.js'); // Add a vegas background from the background node. /* if (function_exists('bg_image_get_image_path_from_node')) { $bg_nid = db_select('node', 'n') ->fields('n', array('nid')) ->condition('type', 'os2web_frontend_background_img') ->execute() ->fetchField(); if ($bg_nid) { // drupal_add_js(path_to_theme() . '/js/jquery.vegas.js'); /* $bg = 'jQuery( function() { jQuery.vegas({ src:\''. bg_image_get_image_path_from_node($bg_nid) .'\' })(\'overlay\', { src:\'/profiles/os2web/themes/os2web_core_theme/images/vegas/overlays/13.png\' }); });'; drupal_add_js($bg, array('type' => 'inline', 'scope' => 'header', 'weight' => 90)); } }*/ }
/** * Override or insert variables into the html template. */ function seven_preprocess_html(&$vars) { // Add conditional CSS for IE8 and below. drupal_add_css(path_to_theme() . '/ie.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE))); // Add conditional CSS for IE6. drupal_add_css(path_to_theme() . '/ie6.css', array('weight' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE))); }
/** * Implements template_preprocess_html(). */ function SUBTHEME_preprocess_html(&$variables) { // CSS files for Internet Explorer-specific styles. drupal_add_css(path_to_theme() . '/css/ie/SUBTHEME-ielt9.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'screen', 'browsers' => array('IE' => 'lt IE 9', '!IE' => FALSE), 'preprocess' => FALSE)); drupal_add_css(path_to_theme() . '/css/ie/SUBTHEME-ielt8.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'screen', 'browsers' => array('IE' => 'lt IE 8', '!IE' => FALSE), 'preprocess' => FALSE)); // Responsive stylesheets. if (theme_get_setting('zentropy_responsive_enable')) { drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-320.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (min-width : 320px) and (max-width : 480px)')); drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-480.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (min-width : 480px) and (max-width: 768px)')); drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-768.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (min-width : 768px) and (max-width: 992px)')); drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-992.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (min-width : 992px) and (max-width: 1382px)')); drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-1382.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (min-width : 1382px)')); // Styles for iPhone 4+, iPad 3+, Opera Mobile 11+ and other high pixel ratio browsers and devices. drupal_add_css(path_to_theme() . '/css/layout/SUBTHEME-hipixel.css', array('group' => CSS_THEME, 'every_page' => TRUE, 'media' => 'only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5), only screen and (-o-min-device-pixel-ratio: 3/2), only screen and (min--moz-device-pixel-ratio: 1.5)')); } else { $fallback = theme_get_setting('zentropy_responsive_fallback'); drupal_add_css(path_to_theme() . "/css/layout/SUBTHEME-{$fallback}.css", array('group' => CSS_THEME, 'every_page' => TRUE)); } /* Add your own custom logic in between the following lines: --------------------------------------------------------------------*/ /* STOP!!!! Don't edit this function below this line! --------------------------------------------------------------------*/ // The below code comments are placeholders for Zentropy optional components downloaded and installed via Drush. // For more information see the section "Advanced Drush Integration" in Zentropy's README.txt or the project page on drupal.org: http://drupal.org/project/zentropy // To find out how to manually enable components (without Drush), read the handbook: http://drupal.org/node/1515894 // IMPORTANT: DO NOT EDIT OR REMOVE THE LINES BELOW UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! $zentropy_scripts_head = array(); #modernizr# #easing# #hoverintent# #bgiframe# $variables['zentropy_scripts_head'] .= implode("\n", $zentropy_scripts_head); }
/** * Implements hook_preprocess_page(). */ function carbon_preprocess_page(&$variables) { $is_front = $variables['is_front']; // Adjust the html element that wraps the site name. h1 on front page, p on other pages $variables['wrapper_site_name_prefix'] = ($is_front ? '<h1' : '<p'); $variables['wrapper_site_name_prefix'] .= ' id="site-name"'; $variables['wrapper_site_name_prefix'] .= ' class="site-name'.($is_front ? ' site-name-front' : '').'"'; $variables['wrapper_site_name_prefix'] .= '>'; $variables['wrapper_site_name_suffix'] = ($is_front ? '</h1>' : '</p>'); // If the theme's info file contains the custom theme setting // default_logo_path, set the $logo variable to that path. $default_logo_path = theme_get_setting('default_logo_path'); if (!empty($default_logo_path) && theme_get_setting('default_logo')) { $variables['logo'] = file_create_url(path_to_theme() . '/' . $default_logo_path); } else { $variables['logo'] = null; } //Arrange the elements of the main content area (content and sidebars) based on the layout class $layoutClass = _carbon_get_layout(); $layout = substr(strrchr($layoutClass, '-'), 1); //Get the last bit of the layout class, the 'abc' string $contentPos = strpos($layout, 'c'); $sidebarsLeft = substr($layout,0,$contentPos); $sidebarsRight = strrev(substr($layout,($contentPos+1))); // Reverse the string so that the floats are correct. $sidebarsHidden = ''; // Create a string of sidebars that are hidden to render and then display:none if(stripos($layout, 'a') === false) { $sidebarsHidden .= 'a'; } if(stripos($layout, 'b') === false) { $sidebarsHidden .= 'b'; } $variables['sidebars']['left'] = str_split($sidebarsLeft); $variables['sidebars']['right'] = str_split($sidebarsRight); $variables['sidebars']['hidden'] = str_split($sidebarsHidden); }
function cignaIndonesia_breadcrumb($variables) { //$breadcrumb = $variables['breadcrumb']; $breadcrumb = drupal_get_breadcrumb(); $breadcrumb = array_unique($breadcrumb); if (!empty($breadcrumb)) { // Provide a navigational heading to give context for breadcrumb links to // screen-reader users. Make the heading invisible with .element-invisible. $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>'; $crumbs = '<div class="breadcrumb">'; $array_size = count($breadcrumb); $i = 0; if (drupal_get_title() != "Search") { while ($i < $array_size) { $pos = strpos($breadcrumb[$i], drupal_get_title()); //we stop duplicates entering where there is a sub nav based on page jumps if ($pos === false) { $crumbs .= '<span class="breadcrumb-' . $i; $crumbs .= '">' . $breadcrumb[$i] . '</span>'; $crumbs .= '<img src="' . base_path() . path_to_theme() . '/images/breadcrumbArrow.gif" width="7" height="6" alt="Breadcrumb arrow" title="Breadcrumb arrow" />'; } $i++; } $crumbs .= '<span class="active">' . drupal_get_title() . '</span></div>'; } if (drupal_get_title() == "Search") { $crumbs .= '<span class="breadcrumb-0'; $crumbs .= '">' . $breadcrumb[0] . '</span>'; $crumbs .= '<img src="' . base_path() . path_to_theme() . '/images/breadcrumbArrow.gif" width="7" height="6" alt="Breadcrumb arrow" title="Breadcrumb arrow" />'; $crumbs .= '<span class="active">' . drupal_get_title() . '</span></div>'; } return $crumbs; } }
/** * PNG transparency compatibility for IE6. */ function hippelicious_style_ie6() { $mask_path = base_path() . path_to_theme() . '/images/mask.png'; $property = "background:transparent; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='{$mask_path}');"; $linkfix = "position:relative;"; return "#sidebar ul.menu a { height:1%; } #main,#utility,#sidebar,#branding div.primary ul.links a,#sidebar ul.menu a.active { {$property} } #main a,#utility a,#sidebar a,#branding div.primary ul.links a,#sidebar ul.menu a.active { {$linkfix} }"; }
/** * Implements hook_preprocess_page(). */ function techoregon_preprocess_page(&$variables) { // If front page, change logo if ($variables['is_front']) { $variables['logo'] = path_to_theme() . '/images/logos/Logo_white_text.png'; } // Remove .navbar-default class from header navbar to avoid unwanted styling if (($key = array_search('navbar-default', $variables['navbar_classes_array'])) !== false) { unset($variables['navbar_classes_array'][$key]); } // If there is a value for hero text or hero image field, then we can assume // there is also a hero text/image view and default page title should not be rendered if (!empty($variables['node']->field_hero_text) || !empty($variables['node']->field_hero_image)) { $variables['title'] = ''; } // Add classes to body based on site section or content type if (!empty($variables['node']->field_site_section)) { switch ($variables['node']->field_site_section['und'][0]['tid']) { // Get Involved case "8": ctools_class_add('section-involved'); break; // What We Do // What We Do case "7": ctools_class_add('section-do'); break; // Who We Are // Who We Are case "6": ctools_class_add('section-are'); break; // Events // Events case "34": ctools_class_add('section-events'); break; // Blog // Blog case "31": ctools_class_add('section-blog'); break; } } if (!empty($variables['node']->type)) { switch ($variables['node']->type) { case "blog": ctools_class_add('section-blog'); break; case "event": ctools_class_add('section-events'); break; } } // If page is landing page content type, add class to body if (!empty($variables['node']->type) && $variables['node']->type == 'landing_page') { ctools_class_add('landing-page'); } }
/** * Preprocess variables for html.tpl.php * * @see system_elements() * @see html.tpl.php */ function commerce_kickstart_theme_preprocess_html(&$variables) { // Add conditional stylesheets for IE drupal_add_css(path_to_theme() . '/css/commerce-kickstart-theme-ie-lte-8.css', array('group' => CSS_THEME, 'weight' => 23, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE)); drupal_add_css(path_to_theme() . '/css/commerce-kickstart-theme-ie-lte-7.css', array('group' => CSS_THEME, 'weight' => 24, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); // Add external libraries. drupal_add_library('commerce_kickstart_theme', 'selectnav'); }
/** * Override or insert variables into the html template. */ function loop_skins_preprocess_html(&$vars) { $skin = theme_get_setting('loop_skins_skin'); if (!$skin) { $skin = 'styles'; } drupal_add_css(path_to_theme() . '/css/' . $skin . '.css', array('group' => CSS_THEME, 'weight' => 999, 'preprocess' => FALSE)); }
/** * Implements hook_preprocess_html(). */ function proma_preprocess_html(&$variables) { $theme_path = path_to_theme(); // Cache path to theme for duration of this function: $path_to_theme = drupal_get_path('theme', 'proma'); // Add 'viewport' meta tag: drupal_add_html_head(array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 'proma:viewport_meta'); }