示例#1
0
/**
 * 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');
}
示例#2
0
/**
 * Preprocess function for Health Insurance Plan Level Bean.
 *
 * @see cignaNewGlobal_preprocess_entity.
 */
function _cignaglobal_preprocess_entity__bean__health_insurance_plan_level(&$vars)
{
    // Preprocess field_badge content for template display.
    $vars['badge'] = '';
    if (isset($vars['content']['field_badge'])) {
        $vars['badge'] = $vars['content']['field_badge']['#items'][0]['value'];
    }
    // Preprocess field_cta_button for brokers microsite.
    if (isset($vars['content']['field_cta_button']['0']['#href']) && is_broker_page()) {
        $vars['content']['field_cta_button'][0]['#href'] = '/brokers/health-insurance-plans/international-medical-insurance';
        if (isset($vars['content']['field_cta_button'][0]['#options'])) {
            $vars['content']['field_cta_button'][0]['#options']['query'] = array();
        }
    }
    // Create mark-up for benefit / exclusion list.
    if (!empty($vars['content']['field_benefit_list']['#items'])) {
        $items =& $vars['content']['field_benefit_list'];
        foreach ($items as $k => $item) {
            if (is_int($k)) {
                $li_class = $item['#item']['second'] != 'On' ? " class='cross'" : '';
                $items[$k]['#item']['first'] = '<li' . $li_class . '>' . strip_tags($item['#item']['first'], '<strong><b><br/>') . '</li>';
                $items[$k]['#item']['second'] = FALSE;
            }
        }
    }
    _cignaglobal_preprocess_entity_bean_update_vars($vars);
}
示例#3
0
/**
 * Implements hook_css_alter().
 */
function cignaglobal_css_alter(&$css)
{
    $theme_path = drupal_get_path('theme', 'cignaglobal');
    // Remove css core and contrib modules.
    if (!user_is_logged_in()) {
        foreach ($css as $key => $css_style_info) {
            if (strpos($key, 'sites/all/modules/contrib') !== FALSE || strpos($key, 'modules/system') !== FALSE || strpos($key, 'modules/field') !== FALSE) {
                unset($css[$key]);
            }
        }
    }
    // Remove the overrides.css.
    $overrides = drupal_get_path('theme', 'bootstrap') . '/css/overrides.css';
    if (isset($css[$overrides])) {
        unset($css[$overrides]);
    }
    // Remove bootstrap css from cdn (we still want cdn js).
    $bootstrap_cdn = theme_get_setting('bootstrap_cdn');
    if ($bootstrap_cdn) {
        // Add CDN.
        if (theme_get_setting('bootstrap_bootswatch')) {
            $cdn = '//netdna.bootstrapcdn.com/bootswatch/' . $bootstrap_cdn . '/' . theme_get_setting('bootstrap_bootswatch') . '/bootstrap.min.css';
        } else {
            $cdn = '//netdna.bootstrapcdn.com/bootstrap/' . $bootstrap_cdn . '/css/bootstrap.min.css';
        }
        unset($css[$cdn]);
    }
    // Drop styles.min.css and iestyles.min.css if a landing page.
    $node = menu_get_object('node');
    if (is_object($node) && isset($node->type) && $node->type == 'landing_page') {
        return;
    }
    // Temporary method of adding brand awareness landing page styling.
    $landing_page_urls = function_exists('cigna_lp_menu_keys') ? cigna_lp_menu_keys() : array();
    if (in_array(current_path(), $landing_page_urls)) {
        $style = $theme_path . '/css/landing--brand.min.css';
        $css[$style] = array('data' => $style, 'type' => 'file', 'scope' => 'header', 'every_page' => FALSE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => 1000);
        return;
    }
    // Work out if on broker pages.
    $is_broker_page = is_broker_page();
    // Add styles.min.css, else brokerstyle.min.css if on broker pages.
    $style = !$is_broker_page ? $theme_path . '/css/style.min.css' : $theme_path . '/css/brokerstyle.min.css';
    $css[$style] = array('data' => $style, 'type' => 'file', 'scope' => 'header', 'every_page' => FALSE, 'media' => 'all', 'preprocess' => TRUE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => TRUE), 'weight' => 1000);
    // Add iestyles.min.css.
    $style = $theme_path . '/css/iestyles.min.css';
    $css[$style] = array('data' => $style, 'type' => 'file', 'every_page' => TRUE, 'media' => 'all', 'preprocess' => FALSE, 'group' => CSS_THEME, 'browsers' => array('IE' => TRUE, '!IE' => FALSE), 'weight' => 1001);
}
示例#4
0
/**
 * Implements hook_js_alter().
 */
function cignaglobal_js_alter(&$js)
{
    $theme_path = drupal_get_path('theme', 'cignaglobal');
    // JS to be exluded: not needed currently for anonymous users.
    $exclude_js = array('sites/all/modules/contrib/views/js/base.js', 'sites/all/modules/contrib/views/js/ajax_view.js', 'sites/all/themes/bootstrap/js/modules/views/js/ajax_view.js', 'sites/all/themes/bootstrap/js/misc/_progress.js', 'sites/all/themes/bootstrap/js/misc/ajax.js', 'sites/all/modules/contrib/jquery_update/replace/misc/jquery.form.min.js', 'sites/all/modules/contrib/jquery_update/replace/ui/external/jquery.cookie.js', 'sites/all/themes/bootstrap/js/bootstrap.js');
    // Place all js in footer except mapbox and exclude unused from Bootstrap theme and Drupal core.
    foreach ($js as $key => $value) {
        $js[$key]['scope'] = strpos($key, 'mapbox.js') !== FALSE ? 'header' : 'footer';
        if (in_array($key, $exclude_js)) {
            unset($js[$key]);
        }
    }
    // Visual Website Optimiser script. This must stay in the header to avoid flicker.
    $vwoScript = 'var _vwo_code=(function(){';
    $vwoScript .= 'var account_id=77201,';
    $vwoScript .= 'settings_tolerance=2000,';
    $vwoScript .= 'library_tolerance=2500,';
    $vwoScript .= 'use_existing_jquery=false,';
    $vwoScript .= 'f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById(\'_vis_opt_path_hides\');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement(\'script\');b.src=a;b.type=\'text/javascript\';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName(\'head\')[0].appendChild(b);},init:function(){settings_timer=setTimeout(\'_vwo_code.finish()\',settings_tolerance);this.load(\'//dev.visualwebsiteoptimizer.com/j.php?a=\'+account_id+\'&u=\'+encodeURIComponent(d.URL)+\'&r=\'+Math.random());var a=d.createElement(\'style\'),b=\'body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}\',h=d.getElementsByTagName(\'head\')[0];a.setAttribute(\'id\',\'_vis_opt_path_hides\');a.setAttribute(\'type\',\'text/css\');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();';
    $js['vwoTagScript'] = drupal_js_defaults();
    $js['vwoTagScript']['data'] = $vwoScript;
    $js['vwoTagScript']['type'] = 'inline';
    $js['vwoTagScript']['scope'] = 'header';
    $js['vwoTagScript']['group'] = JS_THEME;
    $js['vwoTagScript']['every_page'] = TRUE;
    $js['vwoTagScript']['weight'] = 1;
    // Typkeit fonts script. This must stay in the header to load correctly
    $typekitScript = "(function(d) {";
    $typekitScript .= "var config = {";
    $typekitScript .= "kitId: 'djj7lex',";
    $typekitScript .= "scriptTimeout: 3000,";
    $typekitScript .= "async: true";
    $typekitScript .= "},";
    $typekitScript .= "h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\\bwf-loading\\b/g,\"\")+\" wf-inactive\";},config.scriptTimeout),tk=d.createElement(\"script\"),f=false,s=d.getElementsByTagName(\"script\")[0],a;h.className+=\" wf-loading\";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!=\"complete\"&&a!=\"loaded\")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)";
    $typekitScript .= "})(document);";
    $js['TypekitScript'] = drupal_js_defaults();
    $js['TypekitScript']['data'] = $typekitScript;
    $js['TypekitScript']['type'] = 'inline';
    $js['TypekitScript']['scope'] = 'header';
    $js['TypekitScript']['group'] = JS_THEME;
    $js['TypekitScript']['every_page'] = TRUE;
    $js['TypekitScript']['weight'] = 2;
    // A variable for assigning a weight to each js resource.
    $js_footer_weight = 999;
    // Temporary method of adding brand awareness landing javascript
    $landing_page_urls = function_exists('cigna_lp_menu_keys') ? cigna_lp_menu_keys() : array();
    if (in_array(current_path(), $landing_page_urls)) {
        $wistiaEv1JS = '//fast.wistia.com/assets/external/E-v1.js';
        $js[$wistiaEv1JS] = drupal_js_defaults();
        $js[$wistiaEv1JS]['data'] = $wistiaEv1JS;
        $js[$wistiaEv1JS]['type'] = 'file';
        $js[$wistiaEv1JS]['scope'] = 'footer';
        $js[$wistiaEv1JS]['group'] = JS_THEME;
        $js[$wistiaEv1JS]['every_page'] = TRUE;
        $js[$wistiaEv1JS]['weight'] = $js_footer_weight;
        $cignaLandingJS = $theme_path . '/js/cignalanding.min.js';
        $js[$cignaLandingJS] = drupal_js_defaults();
        $js[$cignaLandingJS]['data'] = $cignaLandingJS;
        $js[$cignaLandingJS]['type'] = 'file';
        $js[$cignaLandingJS]['scope'] = 'footer';
        $js[$cignaLandingJS]['group'] = JS_THEME;
        $js[$cignaLandingJS]['every_page'] = TRUE;
        $js[$cignaLandingJS]['weight'] = ++$js_footer_weight;
        /*$wistiaPluginJS = $theme_path . '/js/plugin.js';
          $js[$wistiaPluginJS] = drupal_js_defaults();
          $js[$wistiaPluginJS]['data'] = $wistiaPluginJS;
          $js[$wistiaPluginJS]['type'] = 'file';
          $js[$wistiaPluginJS]['scope'] = 'footer';
          $js[$wistiaPluginJS]['group'] = JS_THEME;
          $js[$wistiaPluginJS]['every_page'] = TRUE;
          $js[$wistiaPluginJS]['weight'] = ++$js_footer_weight;*/
        return;
    }
    // Language switch js.
    $languageSwithcJS = $theme_path . '/js/language.js';
    $js[$languageSwithcJS] = drupal_js_defaults();
    $js[$languageSwithcJS]['data'] = $languageSwithcJS;
    $js[$languageSwithcJS]['type'] = 'file';
    $js[$languageSwithcJS]['scope'] = 'footer';
    $js[$languageSwithcJS]['group'] = JS_THEME;
    $js[$languageSwithcJS]['every_page'] = TRUE;
    $js[$languageSwithcJS]['weight'] = ++$js_footer_weight;
    // Work out if on broker pages.
    $is_broker_page = is_broker_page();
    // Determine which js is required.
    $cignaglobalJS = !$is_broker_page ? $theme_path . '/js/cignaglobal.min.js' : $theme_path . '/js/brokers.min.js';
    $js[$cignaglobalJS] = drupal_js_defaults();
    $js[$cignaglobalJS]['data'] = $cignaglobalJS;
    $js[$cignaglobalJS]['type'] = 'file';
    $js[$cignaglobalJS]['scope'] = 'footer';
    $js[$cignaglobalJS]['group'] = JS_THEME;
    $js[$cignaglobalJS]['every_page'] = TRUE;
    $js[$cignaglobalJS]['weight'] = ++$js_footer_weight;
    // Add affinity partner js.
    $affinityPartnerJS = $theme_path . '/js/affinityPartner.js';
    $js[$affinityPartnerJS] = drupal_js_defaults();
    $js[$affinityPartnerJS]['data'] = $affinityPartnerJS;
    $js[$affinityPartnerJS]['type'] = 'file';
    $js[$affinityPartnerJS]['scope'] = 'footer';
    $js[$affinityPartnerJS]['group'] = JS_THEME;
    $js[$affinityPartnerJS]['every_page'] = TRUE;
    $js[$affinityPartnerJS]['weight'] = ++$js_footer_weight;
    // Ubertag script.
    $uberScript = 'var ut_params = ut_params || [];ut_params.push("UT-238808730");';
    $uberScript .= '(function() {var ut = document.createElement(\'script\'); ut.type = \'text/javascript\'; ut.async = true;';
    $uberScript .= 'ut.src = (("https:" == document.location.protocol) ? "https://" : "http://") + \'app.ubertags.com/javascripts/ubertags.js\';';
    $uberScript .= 'var script = document.getElementsByTagName(\'script\')[0]; script.parentNode.insertBefore(ut, script);})();';
    $js['uberTagScript'] = drupal_js_defaults();
    $js['uberTagScript']['data'] = $uberScript;
    $js['uberTagScript']['type'] = 'inline';
    $js['uberTagScript']['scope'] = 'footer';
    $js['uberTagScript']['group'] = JS_THEME;
    $js['uberTagScript']['every_page'] = TRUE;
    $js['uberTagScript']['weight'] = ++$js_footer_weight;
}