/** * Implements hook_preprocess_html(). * Meta tags https://drupal.org/node/1468582#comment-5698732 */ function treetopstravel_preprocess_html(&$variables) { $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8')); drupal_add_html_head($meta_charset, 'meta_charset'); $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1')); drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible'); $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')); drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized'); $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')); drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly'); $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')); drupal_add_html_head($meta_viewport, 'meta_viewport'); $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on')); drupal_add_html_head($meta_cleartype, 'meta_cleartype'); // Use html5shiv. if (theme_get_setting('html5shim')) { $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'treetopstravel') . '/js/html5shiv-printshiv.js')))); $html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n"); drupal_add_html_head($html5shim, 'treetopstravel_html5shim'); } // Use Respond.js. if (theme_get_setting('respond_js')) { drupal_add_js(drupal_get_path('theme', 'treetopstravel') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100)); } // Use normalize.css if (theme_get_setting('normalize_css')) { drupal_add_css(drupal_get_path('theme', 'treetopstravel') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100)); } if (arg(0) == 'taxonomy' && arg(1) == 'term') { $term = taxonomy_term_load(arg(2)); $variables['classes_array'][] = 'vocabulary-' . strtolower($term->vocabulary_machine_name); } flexslider_add(); }
/** * Implements hook_preprocess_html(). * Adding extra meta tags to the head for iPhone, Google domain verification */ function webskillet14_preprocess_html(&$vars) { $meta_xuacompatible = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1')); drupal_add_html_head($meta_xuacompatible, 'meta_xuacompatible'); $meta_viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, maximum-scale=1.0')); drupal_add_html_head($meta_viewport, 'meta_viewport'); $q = isset($_GET['q']) ? $_GET['q'] : 'front'; $page_id = str_replace('/', '-', $q); $page_id = strtolower($page_id); $page_id = preg_replace('/[^-_a-z0-9]/', '', $page_id); $vars['page_id'] = 'page-' . $page_id; $googlefonts = theme_get_setting('webskillet14_google_webfonts'); if ($googlefonts) { drupal_add_css('//fonts.googleapis.com/css?family=' . $googlefonts, array('type' => 'external', 'group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -100)); } if (theme_get_setting('webskillet14_load_fontawesome')) { drupal_add_css('//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', array('type' => 'external', 'group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -99)); } /* $meta_google_site_verification = array( '#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array( 'name' => 'google-site-verification', 'content' => 'RPsvU9KSNxdpmMt1ejPTeTAnH6DsklrG2Ic7HSpyIec' ) ); drupal_add_html_head($meta_google_site_verification, 'meta_google_site_verification'); */ }
function cstark_preprocess_node(&$variables) { if (user_access('administer nodes')) { $variables['edit_link'] = l(t('Edit'), 'node/' . $variables['nid'] . '/edit'); if ($variables['type'] == 'painting') { $title = $variables['promote'] ? t('Remove from front page') : t('Add to front page'); $variables['set_as_main_link'] = l($title, 'set-as-main/' . $variables['nid']); // Facebook share. $url = url('node/' . $variables['nid'], array('absolute' => TRUE)); $variables['share_link'] = l(t('Share'), "http://www.facebook.com/sharer.php?u={$url}", array('attributes' => array('class' => array('facebook')))); } } if ($variables['type'] == 'painting') { $wrapper = entity_metadata_wrapper('node', $variables['nid']); if ($image = $wrapper->field_image->value()) { $element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:image', 'content' => file_create_url($image['uri']))); drupal_add_html_head($element, 'cstark_painting_image'); $element = array('#tag' => 'meta', '#attributes' => array('property' => 'og:title', 'content' => $wrapper->label())); drupal_add_html_head($element, 'cstark_painting_title'); } } if ($variables['type'] == 'painting' && !drupal_is_front_page()) { $variables['pager'] = shapira_get_painting_pager($variables['nid']); } if ($variables['type'] != 'news') { $variables['hide_title'] = true; } if ($variables['type'] == 'painting') { if ($variables['field_image']) { $info = image_get_info(image_style_path('painting', $variables['field_image'][0]['uri'])); $variables['node_width'] = $info['width']; } } }
/** * Implementation of template_preprocess_html(). */ function radix_preprocess_html(&$variables) { // Add meta for Bootstrap Responsive. // <meta name="viewport" content="width=device-width, initial-scale=1.0"> $element = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0')); drupal_add_html_head($element, 'bootstrap_responsive'); }
/** * Implements hook_preprocess_html(). * Adding extra meta tags to the head for iPhone, Google domain verification */ function webskillet_preprocess_html(&$variables) { $meta_xuacompatible = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1')); drupal_add_html_head($meta_xuacompatible, 'meta_xuacompatible'); $meta_viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, maximum-scale=1.0')); drupal_add_html_head($meta_viewport, 'meta_viewport'); $mobileStyle = theme_get_setting('webskillet_navigation_style'); $variables['classes_array'][] = 'mobile-style-' . $mobileStyle; $dismissStyle = theme_get_setting('webskillet_dismiss_style'); $variables['classes_array'][] = 'dismiss-style-' . $dismissStyle; $settings = array('pathToTheme' => drupal_get_path('theme', variable_get('theme_default', NULL)), 'themeOptions' => array('validateForms' => theme_get_setting('webskillet_js_validate_forms'), 'fixFooter' => theme_get_setting('webskillet_js_fix_footer'), 'shortenLinks' => theme_get_setting('webskillet_js_shorten_links'), 'externalLinks' => theme_get_setting('webskillet_external_links'), 'externalLinksExceptions' => theme_get_setting('webskillet_external_links_exceptions'), 'sectionNavigationSelector' => theme_get_setting('webskillet_section_navigation_selector'), 'sectionNavigationPadding' => theme_get_setting('webskillet_section_navigation_padding'))); drupal_add_js('jQuery.extend(Drupal.settings, ' . json_encode((object) $settings) . ');', 'inline'); $q = isset($_GET['q']) ? $_GET['q'] : 'front'; $page_id = str_replace('/', '-', $q); $page_id = strtolower($page_id); $page_id = preg_replace('/[^-_a-z0-9]/', '', $page_id); $variables['page_id'] = 'page-' . $page_id; $googlefonts = theme_get_setting('webskillet_google_webfonts'); if ($googlefonts) { drupal_add_css('https://fonts.googleapis.com/css?family=' . $googlefonts, array('type' => 'external', 'group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -100)); } // load fontawesome drupal_add_css('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array('type' => 'external', 'group' => CSS_SYSTEM, 'every_page' => TRUE, 'weight' => -99)); if ($google_site_verification = theme_get_setting('webskillet_google_site_verification')) { $meta_google_site_verification = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'google-site-verification', 'content' => $google_site_verification)); drupal_add_html_head($meta_google_site_verification, 'meta_google_site_verification'); } }
/** * Implements hook_preprocess_html(). * Meta tags https://drupal.org/node/1468582#comment-5698732 */ function cetaviano_preprocess_html(&$variables) { $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8')); drupal_add_html_head($meta_charset, 'meta_charset'); $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1')); drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible'); $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')); drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized'); $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')); drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly'); $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')); drupal_add_html_head($meta_viewport, 'meta_viewport'); $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on')); drupal_add_html_head($meta_cleartype, 'meta_cleartype'); // TODO: Include this using Yeoman generator settings // Use html5shiv. $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => 'https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js'))); $html5shiv = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n"); drupal_add_html_head($html5shiv, 'cetaviano_theme_html5shiv'); // ENDTODO // TODO: Include this using Yeoman generator settings // Use Respond.js. $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => 'https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js'))); $respondjs = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n"); drupal_add_html_head($respondjs, 'cetaviano_theme_respondjs'); // ENDTODO // TODO: Include this using Yeoman generator settings // Use normalize.css drupal_add_css('https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css', array('type' => 'external', 'group' => CSS_SYSTEM, 'weight' => -1000)); // ENDTODO }
/** * @file * Contains theme override functions and preprocess functions for the theme. * * ABOUT THE TEMPLATE.PHP FILE * * The template.php file is one of the most useful files when creating or * modifying Drupal themes. You can modify or override Drupal's theme * functions, intercept or make additional variables available to your theme, * and create custom PHP logic. For more information, please visit the Theme * Developer's Guide on Drupal.org: http://drupal.org/theme-guide * * OVERRIDING THEME FUNCTIONS * * The Drupal theme system uses special theme functions to generate HTML * output automatically. Often we wish to customize this HTML output. To do * this, we have to override the theme function. You have to first find the * theme function that generates the output, and then "catch" it and modify it * here. The easiest way to do it is to copy the original function in its * entirety and paste it here, changing the prefix from theme_ to STARTERKIT_. * For example: * * original: theme_breadcrumb() * theme override: STARTERKIT_breadcrumb() * * where STARTERKIT is the name of your sub-theme. For example, the * zen_classic theme would define a zen_classic_breadcrumb() function. * * If you would like to override either of the two theme functions used in Zen * core, you should first look at how Zen core implements those functions: * theme_breadcrumbs() in zen/template.php * theme_menu_local_tasks() in zen/template.php * * For more information, please visit the Theme Developer's Guide on * Drupal.org: http://drupal.org/node/173880 * * CREATE OR MODIFY VARIABLES FOR YOUR THEME * * Each tpl.php template file has several variables which hold various pieces * of content. You can modify those variables (or add new ones) before they * are used in the template files by using preprocess functions. * * This makes THEME_preprocess_HOOK() functions the most powerful functions * available to themers. * * It works by having one preprocess function for each template file or its * derivatives (called template suggestions). For example: * THEME_preprocess_page alters the variables for page.tpl.php * THEME_preprocess_node alters the variables for node.tpl.php or * for node-forum.tpl.php * THEME_preprocess_comment alters the variables for comment.tpl.php * THEME_preprocess_block alters the variables for block.tpl.php * * For more information on preprocess functions and template suggestions, * please visit the Theme Developer's Guide on Drupal.org: * http://drupal.org/node/223440 * and http://drupal.org/node/190815#template-suggestions */ function chctheme_2013_preprocess_html(&$variables) { drupal_add_css('https://www.lehigh.edu/~inis/includes/SiteStyleFooter.css', array('type' => 'external')); drupal_add_css('https://cf.lehigh.edu/webdev/projects/wms/footer-official.css', array('type' => 'external')); $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, user-scalable=yes')); drupal_add_html_head($viewport, 'viewport'); }
/** * Didn't work with preprocess_html, so doing page */ function webspark_seven_preprocess_html(&$variables) { // WEBSPARK-667 - Add meta tag to identify Innovation as a "Webspark" theme // in the DOM $meta_webspark_id = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'Webspark', 'http-equiv' => 'X-Name-of-Distro')); drupal_add_html_head($meta_webspark_id, 'meta_webspark_id'); }
/** * Implements template_preprocess_html(). */ function radix_preprocess_html(&$variables) { global $base_url; // Add Bootstrap JS from CDN if bootstrap library is not installed. if (!module_exists('bootstrap_library')) { $base = parse_url($base_url); $url = $base['scheme'] . '://netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'; drupal_add_js($url, 'external'); } // Add support for the Modenizr module. // Load modernizr.js only if modernizr module is not present. if (!module_exists('modernizr')) { drupal_add_js(drupal_get_path('theme', 'radix') . '/assets/javascripts/modernizr.js'); } // Add meta for Bootstrap Responsive. // <meta name="viewport" content="width=device-width, initial-scale=1.0"> $element = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0')); drupal_add_html_head($element, 'bootstrap_responsive'); // Add some custom classes for panels pages. if (module_exists('page_manager') && count(page_manager_get_current_page())) { $variables['is_panel'] = TRUE; // Get the current panel display and add some classes to body. if ($display = panels_get_current_page_display()) { $variables['classes_array'][] = 'panel-layout-' . $display->layout; // Add a custom class for each region that has content. $regions = array_keys($display->panels); foreach ($regions as $region) { $variables['classes_array'][] = 'panel-region-' . $region; } } } }
/** * Implements hook_preprocess_html(). * Meta tags https://drupal.org/node/1468582#comment-5698732 */ function importacionesgm_preprocess_html(&$variables) { $meta_charset = array('#tag' => 'meta', '#attributes' => array('charset' => 'utf-8')); drupal_add_html_head($meta_charset, 'meta_charset'); $meta_x_ua_compatible = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'x-ua-compatible', 'content' => 'ie=edge, chrome=1')); drupal_add_html_head($meta_x_ua_compatible, 'meta_x_ua_compatible'); $meta_mobile_optimized = array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')); drupal_add_html_head($meta_mobile_optimized, 'meta_mobile_optimized'); $meta_handheld_friendly = array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')); drupal_add_html_head($meta_handheld_friendly, 'meta_handheld_friendly'); $meta_viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')); drupal_add_html_head($meta_viewport, 'meta_viewport'); $meta_cleartype = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on')); drupal_add_html_head($meta_cleartype, 'meta_cleartype'); // Use html5shiv. if (theme_get_setting('html5shim')) { $element = array('element' => array('#tag' => 'script', '#value' => '', '#attributes' => array('type' => 'text/javascript', 'src' => file_create_url(drupal_get_path('theme', 'importacionesgm') . '/js/html5shiv-printshiv.js')))); $html5shim = array('#type' => 'markup', '#markup' => "<!--[if lt IE 9]>\n" . theme('html_tag', $element) . "<![endif]-->\n"); drupal_add_html_head($html5shim, 'sonambulo_html5shim'); } // Use Respond.js. if (theme_get_setting('respond_js')) { drupal_add_js(drupal_get_path('theme', 'importacionesgm') . '/js/respond.min.js', array('group' => JS_LIBRARY, 'weight' => -100)); } // Use normalize.css if (theme_get_setting('normalize_css')) { drupal_add_css(drupal_get_path('theme', 'importacionesgm') . '/css/normalize.css', array('group' => CSS_SYSTEM, 'weight' => -100)); } }
/** * Override or insert variables into the html template. * @param $vars * An array of variables to pass to the theme template. */ function gavias_laikafood_preprocess_html(&$vars) { global $theme, $base_url; global $parent_root; $skin = theme_get_setting('theme_skin'); drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/css/' . ($skin ? 'skins/' . $skin . '/' : '') . 'template.css', array('group' => CSS_DEFAULT, 'type' => 'file')); drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/css/' . ($skin ? 'skins/' . $skin . '/' : '') . 'bootstrap.css', array('group' => CSS_DEFAULT, 'type' => 'file')); if (module_exists('gavias_themer') && theme_get_setting('frontend_panel') == '1' && user_access('gavias_customize_preview')) { gavias_load_fontend(); } if (theme_get_setting('enable_custom_style') == 1 && trim(variable_get('gavias_profile'))) { drupal_add_css(drupal_get_path('theme', 'gavias_laikafood') . '/customize/save/' . variable_get('gavias_profile') . '.css', array('group' => CSS_DEFAULT, 'type' => 'file')); } $viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1'), '#weight' => 1); drupal_add_html_head($viewport, 'viewport'); // Add boxed class if layout is set that way. if (theme_get_setting('site_layout') == 'boxed') { $vars['classes_array'][] = 'boxed'; } if (theme_get_setting('preloader') == '1') { $vars['classes_array'][] = 'js-preloader'; } else { $vars['classes_array'][] = 'not-preloader'; } }
/** * Preprocess html.tpl.php */ function favrskovtheme_preprocess_html(&$vars) { drupal_add_library('system', 'ui.widget'); drupal_add_js(libraries_get_path('swiper') . '/idangerous.swiper.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE)); drupal_add_css('https://fast.fonts.net/cssapi/cb2b1123-533e-44b1-af78-e3702f6bd579.css', array('type' => 'external', 'group' => 'CSS_THEME', 'every_page' => TRUE, 'media' => 'projection, screen')); $jwplayer = drupal_get_js('jwplayer'); $vars['jwplayer'] = $jwplayer; // Added meta tag for IE. $meta_ie_render_engine = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'IE=10', 'http-equiv' => 'X-UA-Compatible')); // Add header meta tag for IE to head drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine'); $multisite_links = theme_get_setting('favrskovtheme_multisite_links'); if (!empty($multisite_links)) { $vars['classes_array'][] = theme_get_setting('favrskovtheme_multisite_links'); } $header_links = theme_get_setting('favrskovtheme_header_links'); if (!empty($header_links)) { $vars['classes_array'][] = $header_links; } if (!empty($vars['background'])) { $vars['classes_array'][] = 'dynamic-background'; } // jQuery custom content scroller drupal_add_js(libraries_get_path('malihu') . '/js/minified/jquery.mCustomScrollbar.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE)); drupal_add_css(libraries_get_path('malihu') . '/jquery.mCustomScrollbar.min.css', array('scope' => 'header', 'group' => CSS_THEME, 'every_page' => TRUE)); }
/** * Implements hook_preprocess_html(). */ function cu_omega_preprocess_html(&$vars) { // Remove page-node- body class foreach ($vars['attributes_array']['class'] as $key => $value) { if ($value == 'page-node-') { unset($vars['attributes_array']['class'][$key]); } } $vars['head_title_array']['slogan'] = 'University of Colorado Boulder'; $vars['head_title'] = implode(' | ', $vars['head_title_array']); //$vars['attributes_array']['class'][]='banner-white'; $headings = theme_get_setting('headings') ? theme_get_setting('headings') : 'headings-bold'; $vars['attributes_array']['class'][] = $headings; $page_title_image_background = theme_get_setting('page_title_image_background') ? theme_get_setting('page_title_image_background') : 'page-title-image-background-white'; $vars['attributes_array']['class'][] = $page_title_image_background; $icon_color = theme_get_setting('block_icons_color') ? theme_get_setting('block_icons_color') : 'block-icons-inherit'; $vars['attributes_array']['class'][] = $icon_color; drupal_add_js(drupal_get_path('theme', 'cu_omega') . '/js/mobile-menu-toggle.js'); drupal_add_js(drupal_get_path('theme', 'cu_omega') . '/js/track-focus.js', array('scope' => 'footer')); $element = array('#tag' => 'link', '#attributes' => array('href' => '//fast.fonts.net/cssapi/86696b99-fb1a-4964-9676-9233fb4fca8f.css', 'rel' => 'stylesheet', 'type' => 'text/css')); if (variable_get('use_fonts', TRUE)) { drupal_add_html_head($element, 'web_fonts'); } // Turn off IE Compatibility Mode $element = array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge')); drupal_add_html_head($element, 'ie_compatibility_mode'); // Check to see if site is responsive or not... $responsive = theme_get_setting('alpha_responsive') ? 'is-responsive' : 'is-not-responsive'; $vars['attributes_array']['class'][] = $responsive; }
/** * Preprocess variables for the html template. */ function psf_atc_preprocess_html(&$variables) { // Disable compatibility mode. Not sure if this is the best place for this // line, but it works. header("X-UA-Compatible: IE=Edge"); // Add Cycle2 plugin to front page. if ($variables['is_front']) { drupal_add_js(libraries_get_path('jquery.cycle2') . '/jquery.cycle2.js', 'file'); drupal_add_js(libraries_get_path('jquery.cycle2.carousel') . '/jquery.cycle2.carousel.js', 'file'); } // Auto-discover RSS feed. $element = array('#tag' => 'link', '#attributes' => array('href' => '/rss.xml', 'rel' => 'alternate', 'type' => 'application/rss+xml')); drupal_add_html_head($element, 'psf_atc'); // Fix zooming of colorbox for mobile. drupal_add_js(' (function ($) { Drupal.behaviors.psfColorbox = { attach: function (context, settings) { if (!Modernizr.touch && typeof(Drupal.settings.colorbox) != "undefined") { Drupal.settings.colorbox.fixed = true; } } }; })(jQuery); ', array('type' => 'inline', 'group' => JS_LIBRARY)); }
/** * 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'); } }
/** * Implements hook_preprocess_page(). */ function cignaglobal_preprocess_page(&$vars) { if (isset($vars['node']->type)) { // Add hook suggestion based on node type. $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type; // All broker urls begin with /brokers so use this fact to ensure pages // in this section use the page--brokers.tpl.php template. $is_broker_page = is_broker_page(); if ($is_broker_page) { $vars['theme_hook_suggestions'][] = 'page__brokers'; $vars['cigna_brokers_americas_tel_no'] = variable_get('cigna_brokers_americas_tel_no'); $vars['cigna_brokers_europe_tel_no'] = variable_get('cigna_brokers_europe_tel_no'); $vars['cigna_brokers_asia_pacific_tel_no'] = variable_get('cigna_brokers_asia_pacific_tel_no'); $vars['cigna_broker_sales_email'] = variable_get('cigna_broker_sales_email'); $vars['cigna_broker_service_email'] = variable_get('cigna_broker_service_email'); } } // Add robots nofollow metatag for landing pages. $landing_page_urls = function_exists('cigna_lp_menu_keys') ? cigna_lp_menu_keys() : array(); if (in_array(current_path(), $landing_page_urls)) { $data = array('#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex, nofollow')); drupal_add_html_head($data, 'cignaglobal_landing_page_no_follow'); } // Site-wide variables. $vars['cigna_worldwide_tel_no'] = variable_get('cigna_worldwide_tel_no', '+44(0)1475 777625'); $vars['cigna_usa_tel_no'] = variable_get('cigna_usa_tel_no', '877.539.6295'); }
function smc_base_preprocess_html(&$variables) { $meta = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=2, minimum-scale=1, user-scalable=yes')); drupal_add_html_head($meta, 'viewport'); $google_webmasters_verification = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'google-site-verification', 'content' => 'juh1PRGi6_1jrLmH_l5n10psg5y6DGYskQjYVQL-GR8')); drupal_add_html_head($google_webmasters_verification, 'google_webmasters_verification'); }
/** * 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'); } }
/** * Preprocesses the wrapping HTML. * * @param array &$variables * Template variables. */ function lt_preprocess_html(&$vars) { $meta_tags['msapplication-TileColor'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#143241')); foreach ($meta_tags as $key => $meta) { drupal_add_html_head($meta, $key); } }
/** * Preprocesses the wrapping HTML. * * @param array &$variables * Template variables. */ function aap_theme_preprocess_html(&$vars) { if ($vars['is_front']) { $handheld = array('#tag' => 'link', '#attributes' => array('href' => 'http://m.aamaadmiparty.org', 'rel' => 'alternate', 'media' => 'handheld')); //Add header for redirecting site mobile view, when opened in mobile drupal_add_html_head($handheld, 'handheld'); } }
function visia_preprocess_html(&$variables) { $theme_path = path_to_theme(); $default_theme_color = theme_get_setting('theme_color'); drupal_add_css($theme_path . '/stylesheets/colors/' . $default_theme_color, array('group' => CSS_THEME, 'every_page' => TRUE, 'weight' => 10000)); drupal_add_html_head(array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 'visia:viewport_meta'); drupal_add_html_head(array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1')), 'anchor:viewport_compatible'); }
function practice_preprocess_html(&$variables) { // Import Google font 'Roboto' drupal_add_css('http://fonts.googleapis.com/css?family=Roboto:100,300,400,700'); // Add a viewport meta tag to the <head> for mobile responsiveness $element = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')); drupal_add_html_head($element, 'viewport_meta_tag'); }
/** * Implements template_preprocess_html() */ function bootstrap_callcenter_preprocess_html(&$variables) { $mobileOptimized = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')); $handheldFriendly = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')); drupal_add_html_head($mobileOptimized, 'mobile-optimized'); drupal_add_html_head($handheldFriendly, 'handheld-friendly'); drupal_add_css('http://fonts.googleapis.com/css?family=Roboto:400,700|Roboto+Slab:400,700', array('type' => 'external')); }
/** * 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'); }
/** * {@inheritdoc} */ public function assets() { $dropbox_app_key = $this->getSetting('dropbox_app_key'); $html_element = array( '#type' => 'markup', '#markup' => '<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="' . $dropbox_app_key . '"></script>' . "\r\n", ); drupal_add_html_head($html_element, 'dropbox_dropin'); drupal_add_js(drupal_get_path('module', 'file_chooser_field') . '/js/file_chooser_field.dropbox.js'); }
/** * {@inheritdoc} */ public function assets() { $onedrive_app_id = $this->getSetting('onedrive_app_id'); $html_element = array( '#type' => 'markup', '#markup' => '<script type="text/javascript" src="https://js.live.net/v5.0/OneDrive.js" id="onedrive-js" client-id="' . $onedrive_app_id . '"></script>' . "\r\n", ); drupal_add_html_head($html_element, 'onedrive_web_picker'); drupal_add_js(drupal_get_path('module', 'file_chooser_field') . '/js/file_chooser_field.onedrive.js'); }
/** * @param $variables */ function beko_preprocess_html(&$variables) { // Add conditional stylesheets for IE drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 6', '!IE' => FALSE), 'preprocess' => FALSE)); // Adding viewport to HTML Header. $viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1')); drupal_add_html_head($viewport, 'viewport'); }
/** * Implements template_preprocess_html(). */ function cbloffset_preprocess_html(&$variables) { global $base_url; $elements = array('MobileOptimized' => array('#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')), 'HandheldFriendly' => array('#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')), 'viewport' => array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 'cleartype' => array('#tag' => 'meta', '#attributes' => array('http-equiv' => 'cleartype', 'content' => 'on')), 'humans_txt' => array('#tag' => 'link', '#attributes' => array('type' => 'text/plain', 'rel' => 'author', 'href' => $base_url . '/' . path_to_theme() . '/humans.txt'))); foreach ($elements as $name => $element) { drupal_add_html_head($element, $name); } drupal_add_css('//fonts.googleapis.com/css?family=Open+Sans', array('type' => 'external', 'every_page' => TRUE)); }
/** * Page alter. */ function bizreview_page_alter($page) { $mobileoptimized = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'MobileOptimized', 'content' => 'width')); $handheldfriendly = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'HandheldFriendly', 'content' => 'true')); $viewport = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')); drupal_add_html_head($mobileoptimized, 'MobileOptimized'); drupal_add_html_head($handheldfriendly, 'HandheldFriendly'); drupal_add_html_head($viewport, 'viewport'); }
function puzzle_preprocess_html(&$vars) { $viewport = array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1')); drupal_add_html_head($viewport, 'viewport'); $main_color = theme_get_setting('main_color'); $vars['classes_array'][] = theme_get_setting('layout_style'); $vars['classes_array'][] = theme_get_setting('main_color'); $vars['classes_array'][] = theme_get_setting('background_color'); }