Beispiel #1
0
function intranet_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        if ($vars['node']->type == 'cxo_messages') {
            drupal_set_title('');
        }
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    $br_banner_var = array('path' => theme_get_setting('bg_image_path', 'intranet'));
    $vars['bg_image'] = theme('image', $br_banner_var);
    $header_banner_var = array('style_name' => 'header_banner', 'path' => theme_get_setting('header_image_path', 'intranet'), 'alt' => 'header_banner', 'title' => 'Sakal header banner', 'attributes' => array('class' => 'headerImage'));
    $vars['header_image'] = theme('image_style', $header_banner_var);
    $footer_banner_var = array('style_name' => 'footer_banner', 'path' => theme_get_setting('footer_image_path', 'intranet'), 'alt' => 'footer_banner', 'title' => 'Sakal footer banner', 'attributes' => array('class' => 'footerImage'));
    $vars['footer_image'] = theme('image_style', $footer_banner_var);
    //set page title
    if (isset($vars['node'])) {
        $default_value = ucfirst(str_replace("_", " ", $vars['node']->type));
        drupal_set_title(variable_get('page_title_' . $vars['node']->type, $default_value));
    }
}
Beispiel #2
0
/**
 * Override or insert variables into the html template.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function fontfolio_preprocess_html(&$vars)
{
    // We want to use core's body class 'no-sidebars' but is useless for us
    // because it doesn't ccounts fontfolio's 'sidebar' region as sidebar.
    // So we first remove it.
    $vars['classes_array'] = array_diff($vars['classes_array'], array('no-sidebars'));
    // And restore it if appropriate.
    if (empty($vars['page']['sidebar'])) {
        $vars['classes_array'][] = 'no-sidebars';
    }
    $vars['path_to_fontfolio'] = drupal_get_path('theme', 'fontfolio');
    $vars['base_path'] = base_path();
    // Attributes for html element.
    $vars['html_attributes_array'] = array('lang' => $vars['language']->language, 'dir' => $vars['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    // We want to insert inline css rules based on fonfolio theme settings.
    $bg_color = check_plain(theme_get_setting('body_bg_color'));
    $data = 'body { background-color: ' . $bg_color . '}';
    drupal_add_css($data, 'inline');
}
Beispiel #3
0
function THEME_NAME_preprocess_page(&$variables)
{
    $header = drupal_get_http_header('status');
    if ($header == '404 Not Found') {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
}
/**
 * Override or insert variables for the page templates.
 */
function millerLiteColTheme_preprocess_page(&$vars)
{
    if (arg(0) == "node" && arg(1) == "99") {
        $vars['theme_hook_suggestions'][] = 'page__lived';
    }
    $header = drupal_get_http_header('status');
    if ($header == '404 Not Found') {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    //drupal_add_css(path_to_theme() . '/css/styles.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    //drupal_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array( 'scope' => 'header', 'weight' => -20 , 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js('https://maps.googleapis.com/maps/api/js?key=AIzaSyBDUCrY-Ih_wLT96QyP2yu7ARawGCbjPjM', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/jquery-11.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/libs/bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/vendor/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/vendor/rainbow-custom.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/vendor/jquery.anchor.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/tabs/initializers.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/popup.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    drupal_add_js(path_to_theme() . '/js/jasny-bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
    //drupal_add_css(path_to_theme() . '/css/brmfiles/bootstrap.min.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    drupal_add_css(path_to_theme() . '/css/brmfiles/jasny-bootstrap.min.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    drupal_add_css(path_to_theme() . '/css/style-beertime.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    drupal_add_css(path_to_theme() . '/css/brmfiles/millerLite-drupal.min.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    //drupal_add_css(path_to_theme() . '/css/brmfiles/style.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    //setcookie('ml_accesoF', '', time() - 60);
    // Se valida si existe una cookie de la edad
    //var_dump($_COOKIE['ml_accesoF']);
    if ($_COOKIE['ml_accesoF'] == 'n0') {
        //drupal_add_js(path_to_theme() . '/js/jquery.js',  array( 'scope' => 'header', 'weight' => -20 , 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/libs/bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_css(path_to_theme() . '/css/styleHaspe.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_js(path_to_theme() . '/js/validacionInicio.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(drupal_get_path('module', 'BRM_millerlite') . '/js/brmMiller.js');
        drupal_add_js(path_to_theme() . '/bxslider/jquery.bxslider.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_css(path_to_theme() . '/bxslider/jquery.bxslider.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
    } elseif (!isset($_COOKIE['ml_accesoF']) || $_COOKIE['ml_accesoF'] == '3sm3nor43d4d') {
        drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/vendor/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/vendor/rainbow-custom.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/vendor/jquery.anchor.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/tabs/initializers.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/popup.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/vendor/modernizr.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/jquery.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/validacionInicio.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/ga.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
        drupal_add_css(path_to_theme() . '/css/estilos-ss.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_css(path_to_theme() . '/fonts/fonts.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_css(path_to_theme() . '/css/testCris.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_css(path_to_theme() . '/css/webfonkit.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_css(path_to_theme() . '/css/animate.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        drupal_add_css(path_to_theme() . '/js/chosen/chosen.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
        $vars['theme_hook_suggestions'][] = 'page__validarEdad';
    }
}
Beispiel #5
0
/**
 * Assign theme hook suggestions for custom templates.
 */
function blocks_preprocess_page(&$vars, $hook)
{
    if (isset($vars['node'])) {
        $suggest = "page__node__{$vars['node']->type}";
        $vars['theme_hook_suggestions'][] = $suggest;
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
}
Beispiel #6
0
function ipress_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
}
Beispiel #7
0
/**
 * Implements hook_preprocess_page().
 */
function glisseo_preprocess_page(&$variables, $hook)
{
    // Add template suggestions for 404 and 403 errors.
    // F.e.: page--404.tpl.php
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['theme_hook_suggestions'][] = 'page__404';
    }
    if ($status == "403 Forbidden") {
        $variables['theme_hook_suggestions'][] = 'page__403';
    }
}
Beispiel #8
0
/**
 * Implements theme_process_html().
 */
function drupalcamp_preprocess_html(&$vars)
{
    $headers = drupal_get_http_header();
    if (isset($headers['status'])) {
        $vars['classes_array'][] = 'error-page';
        if ($headers['status'] == '404 Not Found') {
            $vars['classes_array'][] = 'error-page-404';
        } elseif ($headers['status'] == '403 Forbidden') {
            $vars['classes_array'][] = 'error-page-403';
        }
    }
}
Beispiel #9
0
function kalypso_preprocess_page(&$vars, $hook)
{
    if (isset($vars['node'])) {
        $suggest = "page__node__{$vars['node']->type}";
        $vars['theme_hook_suggestions'][] = $suggest;
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    // We need to rebuild the scripts variable with the new script included.
    $variables['scripts'] = drupal_get_js();
}
Beispiel #10
0
/**
 * Modify theme_preprocess_page()
 */
function goodnex_preprocess_page(&$vars, $hook)
{
    if (isset($vars['node'])) {
        $suggest = "page__node__{$vars['node']->type}";
        $vars['theme_hook_suggestions'][] = $suggest;
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    if (arg(0) == 'taxonomy' && arg(1) == 'term') {
        $term = taxonomy_term_load(arg(2));
        $vars['theme_hook_suggestions'][] = 'page--taxonomy--vocabulary--' . $term->vid;
    }
}
Beispiel #11
0
/**
 * Implements HOOK_preprocess_THEME()
 * @param $variables
 */
function realia_preprocess_page(&$variables)
{
    if (arg(0) == 'node' && arg(2) == 'edit' && isset($variables['node'])) {
        $nodeObj = $variables['node'];
        if ($nodeObj->type == 'apartment') {
            drupal_set_title(t('Edit Machinery @title', array('@title' => $nodeObj->title)));
        }
    }
    if (current_path() == 'node/add/apartment') {
        drupal_set_title(t('Add your machine'));
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['theme_hook_suggestions'][] = 'page__404';
    }
}
 /**
  * Add response status and headers from legacy controllers.
  *
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     if (null === $this->matcher || $this->matcher->matches($request)) {
         $response = $event->getResponse();
         $headers = drupal_get_http_header();
         $header_names = _drupal_set_preferred_header_name();
         foreach ($headers as $name_lower => $value) {
             if ($name_lower == 'status') {
                 $response->setStatusCode($value);
             } elseif ($value !== FALSE) {
                 $response->headers->set($header_names[$name_lower], $value);
             }
         }
     }
 }
Beispiel #13
0
/**
 * Implimenting hook_process_page
 * Allows you to use node-type based page templates.
 * Adds admininstration menu 
 */
function BaseBuildingBlocks_preprocess_page(&$vars)
{
    global $user;
    global $base_url;
    //Allows you to use node-type, and node ID base page templates
    //Adds custom 404 error page template
    if (!empty($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->vid;
    } elseif (drupal_get_http_header('status')) {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    //Construct the Management Menu
    if (theme_get_setting('admin_menu_on_off') == 1 && in_array('administrator', array_values($user->roles))) {
        //Get the management menu from the drupal menu system, construct menu
        $vars['admin_menu_expanded'] = BaseBuildingBlocks_build_navbar('management');
    }
}
Beispiel #14
0
function manis_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    //Taxonomy page
    if (arg(0) == 'taxonomy') {
        $vars['theme_hook_suggestions'][] = 'page__taxonomy';
    }
    //View template
    if (views_get_page_view()) {
        $vars['theme_hook_suggestions'][] = 'page__view';
    }
    drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . base_path() . path_to_theme() . '" });', 'inline');
}
/**
 * Fix for SEO
 */
function start_html_head_alter(&$head_elements)
{
    // Unset canonical metatag from 404 pages
    $status = drupal_get_http_header("status");
    if ($status === '404 Not Found') {
        if (isset($head_elements['metatag_canonical'])) {
            unset($head_elements['metatag_canonical']);
        }
    }
    // Unset Short link metatag
    if (isset($head_elements['metatag_shortlink'])) {
        unset($head_elements['metatag_shortlink']);
    }
    // Fix canonical metatag for Frontpage
    if (drupal_is_front_page()) {
        if (isset($head_elements['metatag_canonical'])) {
            $head_elements['metatag_canonical']['#value'] = '/';
        }
    }
}
 /**
  * Sets extra headers on successful responses.
  *
  * @param Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
  *   The event to process.
  */
 public function onRespond(FilterResponseEvent $event)
 {
     if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
         return;
     }
     $request = $event->getRequest();
     $response = $event->getResponse();
     // Set the X-UA-Compatible HTTP header to force IE to use the most recent
     // rendering engine or use Chrome's frame rendering engine if available.
     $response->headers->set('X-UA-Compatible', 'IE=edge,chrome=1', FALSE);
     // Set the Content-language header.
     $response->headers->set('Content-language', $this->languageManager->getCurrentLanguage()->id);
     // Attach globally-declared headers to the response object so that Symfony
     // can send them for us correctly.
     // @todo remove this once we have removed all drupal_add_http_header()
     //   calls.
     $headers = drupal_get_http_header();
     foreach ($headers as $name => $value) {
         $response->headers->set($name, $value, FALSE);
     }
     $is_cacheable = drupal_page_is_cacheable();
     // Add headers necessary to specify whether the response should be cached by
     // proxies and/or the browser.
     if ($is_cacheable && $this->config->get('cache.page.max_age') > 0) {
         if (!$this->isCacheControlCustomized($response)) {
             $this->setResponseCacheable($response, $request);
         }
     } else {
         $this->setResponseNotCacheable($response, $request);
     }
     // Currently it is not possible to cache some types of responses. Therefore
     // exclude binary file responses (generated files, e.g. images with image
     // styles) and streamed responses (files directly read from the disk).
     // see: https://github.com/symfony/symfony/issues/9128#issuecomment-25088678
     if ($is_cacheable && $this->config->get('cache.page.use_internal') && !$response instanceof BinaryFileResponse && !$response instanceof StreamedResponse) {
         // Store the response in the internal page cache.
         drupal_page_set_cache($response, $request);
         $response->headers->set('X-Drupal-Cache', 'MISS');
         drupal_serve_page_from_cache($response, $request);
     }
 }
 public static function deliverRawHtmlPage($result)
 {
     if (is_int($result)) {
         drupal_deliver_html_page($result);
         return;
     }
     // Emit the correct charset HTTP header, but not if the page callback
     // result is NULL, since that likely indicates that it printed something
     // in which case, no further headers may be sent, and not if code running
     // for this page request has already set the content type header.
     if (isset($result) && is_null(drupal_get_http_header('Content-Type'))) {
         drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
     }
     // Send appropriate HTTP-Header for browsers and search engines.
     global $language;
     drupal_add_http_header('Content-Language', $language->language);
     if (isset($result)) {
         print render($result);
     }
     drupal_page_footer();
 }
function cami_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    if (isset($vars['node'])) {
        //print $vars['node']->type;
        if ($vars['node']->type == 'page') {
            $node = node_load($vars['node']->nid);
            $output = field_view_field('node', $node, 'field_show_page_title', array('label' => 'hidden'));
            $vars['field_show_page_title'] = $output;
            //sidebar
            $output = field_view_field('node', $node, 'field_sidebar', array('label' => 'hidden'));
            $vars['field_sidebar'] = $output;
        }
    }
}
Beispiel #19
0
/**
 * Override or insert variables into the page template.
 */
function mentor_preprocess_page(&$vars)
{
    if (isset($vars['main_menu'])) {
        $vars['main_menu'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'main-menu-links', 'class' => array('links', 'menu', 'clearfix')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['main_menu'] = FALSE;
    }
    if (isset($vars['secondary_menu'])) {
        $vars['secondary_menu'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('id' => 'secondary-menu-links', 'class' => array('links', 'inline', 'clearfix')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
    } else {
        $vars['secondary_menu'] = FALSE;
    }
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . str_replace('_', '--', $vars['node']->type);
    }
    $status = drupal_get_http_header("status");
    if ($status == "403 Forbidden") {
        $vars['theme_hook_suggestions'][] = 'page__403';
    }
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
}
Beispiel #20
0
/**
 * Assign theme hook suggestions for custom templates.
 */
function jollyany_preprocess_page(&$vars, $hook)
{
    if (isset($vars['node'])) {
        $suggest = "page__{$vars['node']->type}";
        $vars['theme_hook_suggestions'][] = $suggest;
    }
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    if (arg(0) == 'taxonomy' && arg(1) == 'term') {
        $term = taxonomy_term_load(arg(2));
        $vars['theme_hook_suggestions'][] = 'page--taxonomy--' . $term->vid;
    }
    // If this is a panel page, add template suggestions.
    if ($panel_page = page_manager_get_current_page()) {
        // Add a generic suggestion for all panel pages.
        $vars['theme_hook_suggestions'][] = 'page__panel';
        // Add the panel page machine name to the template suggestions.
        $vars['theme_hook_suggestions'][] = 'page__' . $panel_page['name'];
        // Add a body class for good measure.
        $body_classes[] = 'page-panel';
    }
}
Beispiel #21
0
function theme_preprocess_page(&$variables)
{
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $variables['theme_hook_suggestions'][] = 'page__404';
    }
    if ($status == "403 Forbidden") {
        $variables['theme_hook_suggestions'][] = 'page__403';
    }
    if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
        unset($variables['page']['content']['system_main']['term_heading']['#prefix']);
        unset($variables['page']['content']['system_main']['term_heading']['#suffix']);
    }
    //if(isset($variables['node']) && $variables['node']->type == "your_content_type") {
    //drupal_set_title("my_title");
    //}
    $variables['page']['titleclass'] = 'title__about';
    //dpm($variables);
    if (isset($variables['node'])) {
        if (isset($variables['node']->field_descr)) {
            $field_descr = field_get_items('node', $variables['node'], 'field_descr');
            $variables['page']['descr'] = field_view_value('node', $variables['node'], 'field_descr', $field_descr[0]);
        }
        if ($variables['node']->type == 'info') {
            $variables['page']['titleclass'] = 'title__info';
            $voc = taxonomy_vocabulary_load(5);
            if (isset($voc->field_descr)) {
                $field_descr = field_get_items('taxonomy_vocabulary', $voc, 'field_descr');
                $variables['page']['descr'] = field_view_value('taxonomy_vocabulary', $voc, 'field_descr', $field_descr[0]);
            }
        }
    } else {
        if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
            $variables['page']['titleclass'] = 'title__tarifs';
        } else {
            if (function_exists('views_get_page_view') && views_get_page_view()) {
                $view = views_get_page_view();
                //dpm($view);
                if ($view->name == 'tarifs') {
                    $variables['page']['titleclass'] = 'title__tarifs';
                    $voc = taxonomy_vocabulary_load(2);
                    if (isset($voc->field_descr)) {
                        $field_descr = field_get_items('taxonomy_vocabulary', $voc, 'field_descr');
                        $variables['page']['descr'] = field_view_value('taxonomy_vocabulary', $voc, 'field_descr', $field_descr[0]);
                    }
                } else {
                    if ($view->name == 'info') {
                        $variables['page']['titleclass'] = 'title__info';
                        $voc = taxonomy_vocabulary_load(5);
                        if (isset($voc->field_descr)) {
                            $field_descr = field_get_items('taxonomy_vocabulary', $voc, 'field_descr');
                            $variables['page']['descr'] = field_view_value('taxonomy_vocabulary', $voc, 'field_descr', $field_descr[0]);
                        }
                    } else {
                        if ($view->name == 'contacts') {
                            $variables['page']['titleclass'] = 'title__contact';
                            $voc = taxonomy_vocabulary_load(3);
                            if (isset($voc->field_descr)) {
                                $field_descr = field_get_items('taxonomy_vocabulary', $voc, 'field_descr');
                                $variables['page']['descr'] = field_view_value('taxonomy_vocabulary', $voc, 'field_descr', $field_descr[0]);
                            }
                        } else {
                            if ($view->name == 'price') {
                                $variables['page']['titleclass'] = 'title__price';
                                $voc = taxonomy_vocabulary_load(4);
                                if (isset($voc->field_descr)) {
                                    $field_descr = field_get_items('taxonomy_vocabulary', $voc, 'field_descr');
                                    $variables['page']['descr'] = field_view_value('taxonomy_vocabulary', $voc, 'field_descr', $field_descr[0]);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
Beispiel #22
0
/**
 * EIGEDR-140 Add IE Edge support and Chrome Frame
 * https://www.drupal.org/node/1203112
 * http://dropbucket.org/node/1248
 */
function _add_ie_edge_support()
{
    if (drupal_get_http_header('X-UA-Compatible') === NULL) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $meta_ie_edge = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('http-equiv' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1'), '#weight' => -99999);
    // Add header meta tag for IE to head
    drupal_add_html_head($meta_ie_edge, 'meta_ie_edge');
}
Beispiel #23
0
function heshel_preprocess_page(&$vars)
{
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
    }
    if (isset($vars['node'])) {
        $vars['theme_hook_suggestions'][] = 'page__node__' . $vars['node']->nid;
    }
    //404 page
    $status = drupal_get_http_header("status");
    if ($status == "404 Not Found") {
        $vars['theme_hook_suggestions'][] = 'page__404';
    }
    if (isset($vars['node'])) {
        if ($vars['node']->type == 'biblio') {
            $vars['theme_hook_suggestions'][] = 'page__biblio';
            //drupal_add_js(path_to_theme().'/js/related_load.js');
        }
    }
    if (isset($vars['node'])) {
        if ($vars['node']->type == 'page') {
            $node = node_load($vars['node']->nid);
            $output = field_view_field('node', $node, 'field_show_page_title', array('label' => 'hidden'));
            $vars['field_show_page_title'] = $output;
            //sidebar
            $output = field_view_field('node', $node, 'field_sidebar', array('label' => 'hidden'));
            $vars['field_sidebar'] = $output;
        }
    }
}
Beispiel #24
0
/**
 * Implements template_preprocess_block().
 */
function ec_resp_preprocess_block(&$variables)
{
    global $user, $language;
    $block_no_panel = array('search' => 'form', 'print' => 'print-links', 'print_ui' => 'print-links', 'workbench' => 'block', 'social_bookmark' => 'social-bookmark', 'views' => 'view_ec_content_slider-block', 'om_maximenu' => array('om-maximenu-1', 'om-maximenu-2'), 'menu' => 'menu-service-tools', 'cce_basic_config' => 'footer_ipg');
    // List of all blocks that don't need their title to be displayed.
    $block_no_title = array('fat_footer' => 'fat-footer', 'om_maximenu' => array('om-maximenu-1', 'om-maximenu-2'), 'menu' => 'menu-service-tools', 'cce_basic_config' => 'footer_ipg');
    $block_no_body_class = array();
    $panel = TRUE;
    foreach ($block_no_panel as $key => $value) {
        if ($variables['block']->module == $key) {
            if (is_array($value)) {
                foreach ($value as $delta) {
                    if ($variables['block']->delta == $delta) {
                        $panel = FALSE;
                        break;
                    }
                }
            } else {
                if ($variables['block']->delta == $value) {
                    $panel = FALSE;
                    break;
                }
            }
        }
    }
    $title = TRUE;
    foreach ($block_no_title as $key => $value) {
        if ($variables['block']->module == $key) {
            if (is_array($value)) {
                foreach ($value as $delta) {
                    if ($variables['block']->delta == $delta) {
                        $title = FALSE;
                        break;
                    }
                }
            } else {
                if ($variables['block']->delta == $value) {
                    $title = FALSE;
                    break;
                }
            }
        }
    }
    $body_class = TRUE;
    foreach ($block_no_body_class as $key => $value) {
        if ($variables['block']->module == $key && $variables['block']->delta == $value) {
            $body_class = FALSE;
        }
    }
    $variables['panel'] = $panel;
    $variables['title'] = $title;
    $variables['body_class'] = $body_class;
    if (isset($variables['block']->bid)) {
        switch ($variables['block']->bid) {
            case 'locale-language':
                $languages = language_list();
                $items = array();
                $items[] = array('data' => '<span class="off-screen">' . t("Current language") . ':</span> ' . $language->language, 'class' => array('selected'), 'title' => $language->native, 'lang' => $language->language);
                // Get path of translated content.
                $translations = translation_path_get_translations(current_path());
                $language_default = language_default();
                foreach ($languages as $language_object) {
                    $prefix = $language_object->language;
                    $language_name = $language_object->name;
                    if (isset($translations[$prefix])) {
                        $path = $translations[$prefix];
                    } else {
                        $path = current_path();
                    }
                    // Get the related url alias
                    // Check if the multisite language negotiation
                    // with suffix url is enabled.
                    $language_negociation = variable_get('language_negotiation_language');
                    if (isset($language_negociation['locale-url-suffix'])) {
                        $delimiter = variable_get('language_suffix_delimiter', '_');
                        $alias = drupal_get_path_alias($path, $prefix);
                        if ($alias == variable_get('site_frontpage', 'node')) {
                            $path = $prefix == 'en' ? '' : 'index';
                        } else {
                            if ($alias != $path) {
                                $path = $alias;
                            } else {
                                $path = drupal_get_path_alias(isset($translations[$language_name]) ? $translations[$language_name] : $path, $language_name);
                            }
                        }
                    } else {
                        $path = drupal_get_path_alias($path, $prefix);
                    }
                    // Add enabled languages.
                    if ($language_name != $language->name) {
                        $items[] = array('data' => l($language_name, filter_xss($path), array('attributes' => array('hreflang' => $prefix, 'lang' => $prefix, 'title' => $language_name), 'language' => $language_object)));
                    }
                }
                $variables['language_list'] = theme('item_list', array('items' => $items));
                break;
            case 'system-user-menu':
                if ($user->uid) {
                    $name = theme('username', array('account' => $user, 'nolink' => TRUE));
                    $variables['welcome_message'] = "<div class='username'>" . t('Welcome,') . ' <strong>' . $name . '</strong></div>';
                }
                $menu = menu_navigation_links("user-menu");
                $items = array();
                // Manage redirection after login.
                $status = drupal_get_http_header('status');
                if (strpos($status, '404') !== FALSE) {
                    $dest = 'home';
                } elseif (strpos(current_path(), 'user/register') !== FALSE) {
                    $dest = 'home';
                } elseif (strpos(current_path(), 'user/login') !== FALSE) {
                    $dest = 'home';
                } else {
                    $dest = drupal_get_path_alias();
                }
                foreach ($menu as $item_id) {
                    // Get icon links to menu item.
                    $icon = isset($item_id['attributes']['data-image']) ? $item_id['attributes']['data-image'] : '';
                    // Get display title option.
                    $display_title = isset($item_id['attributes']['data-display-title']) ? $item_id['attributes']['data-display-title'] : 1;
                    // Add the icon.
                    if ($icon) {
                        if ($display_title) {
                            $item_id['title'] = '<span class="glyphicon glyphicon-' . $icon . '" aria-hidden="true"></span> ' . $item_id['title'];
                        } else {
                            // If the title is not supposed to be displayed, add a visually
                            // hidden title that is accessible for screen readers.
                            $item_id['title'] = '<span class="glyphicon glyphicon-' . $icon . ' menu-no-title" aria-hidden="true"></span><span class="sr-only">' . $item_id['title'] . '</span>';
                        }
                    }
                    // Add redirection for login, logout and register.
                    if ($item_id['href'] == 'user/login' || $item_id['href'] == 'user/register') {
                        $item_id['query']['destination'] = $dest;
                    }
                    if ($item_id['href'] == 'user/logout') {
                        $item_id['query']['destination'] = '<front>';
                    }
                    // Add icon before menu item
                    // TODO: make it editable in administration.
                    switch ($item_id['href']) {
                        case 'user':
                            $item_id['attributes']['type'] = 'user';
                            break;
                        case 'user/login':
                            $item_id['attributes']['type'] = 'login';
                            break;
                        case 'user/logout':
                            $item_id['attributes']['type'] = 'logout';
                            break;
                        case 'admin/workbench':
                            $item_id['attributes']['type'] = 'workbench';
                            break;
                    }
                    $item_id['html'] = TRUE;
                    $items[] = l($item_id['title'], $item_id['href'], $item_id);
                }
                $variables['menu_items'] = implode('', $items);
                break;
            case 'easy_breadcrumb-easy_breadcrumb':
                $variables['menu_breadcrumb'] = menu_tree('menu-breadcrumb-menu');
                break;
        }
    }
}
/**
 * Override or insert variables into the html template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered. This is usually "html", but can
 *   also be "maintenance_page" since zen_preprocess_maintenance_page() calls
 *   this function to have consistent variables.
 */
function zen_preprocess_html(&$variables, $hook)
{
    // Add variables and paths needed for HTML5 and responsive support.
    $variables['base_path'] = base_path();
    $variables['path_to_zen'] = drupal_get_path('theme', 'zen');
    // Get settings for HTML5 and responsive support. array_filter() removes
    // items from the array that have been disabled.
    $html5_respond_meta = array_filter((array) theme_get_setting('zen_html5_respond_meta'));
    $variables['add_respond_js'] = in_array('respond', $html5_respond_meta);
    $variables['add_html5_shim'] = in_array('html5', $html5_respond_meta);
    $variables['default_mobile_metatags'] = in_array('meta', $html5_respond_meta);
    // If the user is silly and enables Zen as the theme, add some styles.
    if ($GLOBALS['theme'] == 'zen') {
        include_once './' . $variables['path_to_zen'] . '/zen-internals/template.zen.inc';
        _zen_preprocess_html($variables, $hook);
    }
    // Attributes for html element.
    $variables['html_attributes_array'] = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $variables['skip_link_anchor'] = theme_get_setting('zen_skip_link_anchor');
    $variables['skip_link_text'] = theme_get_setting('zen_skip_link_text');
    // Return early, so the maintenance page does not call any of the code below.
    if ($hook != 'html') {
        return;
    }
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    if (!$variables['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        list($section, ) = explode('/', $path, 2);
        $arg = explode('/', $_GET['q']);
        if ($arg[0] == 'node' && isset($arg[1])) {
            if ($arg[1] == 'add') {
                $section = 'node-add';
            } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
                $section = 'node-' . $arg[2];
            }
        }
        $variables['classes_array'][] = drupal_html_class('section-' . $section);
    }
    if (theme_get_setting('zen_wireframes')) {
        $variables['classes_array'][] = 'with-wireframes';
        // Optionally add the wireframes style.
    }
    // Store the menu item since it has some useful information.
    $variables['menu_item'] = menu_get_item();
    if ($variables['menu_item']) {
        switch ($variables['menu_item']['page_callback']) {
            case 'views_page':
                // Is this a Views page?
                $variables['classes_array'][] = 'page-views';
                break;
            case 'page_manager_page_execute':
            case 'page_manager_node_view':
            case 'page_manager_contact_site':
                // Is this a Panels page?
                $variables['classes_array'][] = 'page-panels';
                break;
        }
    }
}
Beispiel #26
0
 /**
  * Inserts the xua-compatible header if the user has accepted
  * ToS and has API key
  */
 public static function set_xua_compatible_header()
 {
     if (ShareaholicUtilities::has_tos_and_apikey() && !drupal_get_http_header('X-UA-Compatible')) {
         drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
     }
 }
Beispiel #27
0
/**
 * Overwrite theme_breadcrumb().
 */
function bht_theme_breadcrumb($variables)
{
    $output = '';
    // Remove breadcrumbs for 403 / 404.
    $headers = drupal_get_http_header();
    if (isset($headers['status']) && $headers['status'] == '404 Not Found') {
        return NULL;
    }
    if (isset($headers['status']) && $headers['status'] == '403 Forbidden') {
        return NULL;
    }
    $breadcrumb = $variables['breadcrumb'];
    if (!empty($breadcrumb)) {
        $total_crumbs = count($breadcrumb);
        // Replace any placeholders for wbr tags.
        foreach (element_children($breadcrumb) as $key => $value) {
            $breadcrumb[$value] = str_replace('||', '', $breadcrumb[$value]);
        }
        $output = '<span class="breadcrumb__title">' . t('You are here: ') . '</span>';
        $i = 0;
        $output .= '<ol class="breadcrumb__list" itemscope itemtype="http://schema.org/BreadcrumbList">';
        foreach ($breadcrumb as $crumb) {
            // Add classes to the crumb.
            $crumb_attributes = array('class' => array('breadcrumb__item'));
            if (++$i === 1) {
                $crumb_attributes['class'][] = 'first';
            }
            if ($i === $total_crumbs) {
                $crumb_attributes['class'][] = 'last';
            }
            $output .= '<li ' . drupal_attributes($crumb_attributes) . ' itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">';
            $output .= $crumb . '<meta itemprop="position" content="' . $i . '" />';
            // Each crumb is themed by bht_mtbp module
            $output .= '</li>';
        }
        $output .= '</ol>';
        // Add a back button at the end of the menu trail.
        if (module_exists('bht_mtbp')) {
            $output .= _bht_mtbp_back_link();
        }
    }
    return $output;
}
Beispiel #28
0
/**
 * Override or insert variables into the html template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered. This is usually "html", but can
 *   also be "maintenance_page" since gwt_drupal_preprocess_maintenance_page() calls
 *   this function to have consistent variables.
 */
function gwt_drupal_preprocess_html(&$variables, $hook)
{
    // Add variables and paths needed for HTML5 and responsive support.
    $variables['base_path'] = base_path();
    $variables['path_to_gwt_drupal'] = drupal_get_path('theme', 'gwt_drupal');
    // Get settings for HTML5 and responsive support. array_filter() removes
    // items from the array that have been disabled.
    $html5_respond_meta = array_filter((array) theme_get_setting('gwt_drupal_html5_respond_meta'));
    $variables['add_respond_js'] = in_array('respond', $html5_respond_meta);
    $variables['add_html5_shim'] = in_array('html5', $html5_respond_meta);
    $variables['default_mobile_metatags'] = in_array('meta', $html5_respond_meta);
    $variables['path_to_gwt'] = drupal_get_path('theme', 'gwt_drupal');
    // Attributes for html element.
    $variables['html_attributes_array'] = array('lang' => $variables['language']->language, 'dir' => $variables['language']->dir);
    // Send X-UA-Compatible HTTP header to force IE to use the most recent
    // rendering engine or use Chrome's frame rendering engine if available.
    // This also prevents the IE compatibility mode button to appear when using
    // conditional classes on the html tag.
    if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
        drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
    }
    $variables['skip_link_anchor'] = theme_get_setting('gwt_drupal_skip_link_anchor');
    $variables['skip_link_text'] = theme_get_setting('gwt_drupal_skip_link_text');
    // Return early, so the maintenance page does not call any of the code below.
    if ($hook != 'html') {
        return;
    }
    // Serialize RDF Namespaces into an RDFa 1.1 prefix attribute.
    if ($variables['rdf_namespaces']) {
        $prefixes = array();
        foreach (explode("\n  ", ltrim($variables['rdf_namespaces'])) as $namespace) {
            // Remove xlmns: and ending quote and fix prefix formatting.
            $prefixes[] = str_replace('="', ': ', substr($namespace, 6, -1));
        }
        $variables['rdf_namespaces'] = ' prefix="' . implode(' ', $prefixes) . '"';
    }
    // Classes for body element. Allows advanced theming based on context
    // (home page, node of certain type, etc.)
    if (!$variables['is_front']) {
        // Add unique class for each page.
        $path = drupal_get_path_alias($_GET['q']);
        // Add unique class for each website section.
        list($section, ) = explode('/', $path, 2);
        $arg = explode('/', $_GET['q']);
        if ($arg[0] == 'node' && isset($arg[1])) {
            if ($arg[1] == 'add') {
                $section = 'node-add';
            } elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
                $section = 'node-' . $arg[2];
            }
        }
        $variables['classes_array'][] = drupal_html_class('section-' . $section);
    }
    if (theme_get_setting('gwt_drupal_wireframes')) {
        $variables['classes_array'][] = 'with-wireframes';
        // Optionally add the wireframes style.
    }
    // Store the menu item since it has some useful information.
    $variables['menu_item'] = menu_get_item();
    if ($variables['menu_item']) {
        switch ($variables['menu_item']['page_callback']) {
            case 'views_page':
                // Is this a Views page?
                $variables['classes_array'][] = 'page-views';
                break;
            case 'page_manager_blog':
            case 'page_manager_blog_user':
            case 'page_manager_contact_site':
            case 'page_manager_contact_user':
            case 'page_manager_node_add':
            case 'page_manager_node_edit':
            case 'page_manager_node_view_page':
            case 'page_manager_page_execute':
            case 'page_manager_poll':
            case 'page_manager_search_page':
            case 'page_manager_term_view_page':
            case 'page_manager_user_edit_page':
            case 'page_manager_user_view_page':
                // Is this a Panels page?
                $variables['classes_array'][] = 'page-panels';
                break;
        }
    }
}
/**
 * Override or insert variables into the page templates.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function hpszen_preprocess_page(&$variables, $hook)
{
    // Add theme wrapper for HTTP error pages
    $status = drupal_get_http_header('status');
    switch ($status) {
        case '404 Not Found':
        case '403 Forbidden':
            if (isset($variables['page']['content']['system_main']['main']['#markup']) && !preg_match('/^<div/', $variables['page']['content']['system_main']['main']['#markup'])) {
                $variables['page']['content']['system_main']['main']['#prefix'] = '<div class="section"><div class="section-inner"><p>';
                $variables['page']['content']['system_main']['main']['#suffix'] = '</p></div></div>';
            }
            break;
    }
    // @note Removed log in link that was being added to secondary menu here
    //       programmatically. Instead add login and logout links to menus
    //       through GUI and use user/login? as path to avoid access issues
    //       when creating the menu item. Alternatively use path alias.
    // @see http://drupal.stackexchange.com/questions/75824/user-login-page-no-access-to-it
}
Beispiel #30
0
/**
 * Implementing hook_process_page()
 */
function jjamerson_lc_preprocess_page(&$variables)
{
    $base_theme = 'jjamerson';
    global $base_url, $base_path, $user;
    global $_bss_section_information;
    if (isset($_bss_section_information['tid'])) {
        $site_section_tid = $_bss_section_information['tid'];
    }
    if (isset($node['language'])) {
        $lang = $node['language'];
    } else {
        $lang = 'und';
    }
    // Set a current node variable, because otherwise actions that rely on field data will affect
    // both the draft & published version of the page.
    if (function_exists('workbench_moderation_node_current_load')) {
        if (substr($_GET['q'], -strlen('/draft')) === '/draft') {
            $current_node = workbench_moderation_node_current_load($variables['node']);
        } else {
            $current_node = $variables['node'];
        }
    } else {
        $current_node = $variables['node'];
    }
    // Check to see if this is a stand-alone site section. First we fetch the site section ID, if
    // it's available (if the section menu block exists, then it should be available):
    if (isset($variables['page']['sidebar_first']['berklee_site_section_menu']['#block']->tid)) {
        $site_section = taxonomy_term_load($site_section_tid);
        $section_parent_link = drupal_get_path_alias('node/' . $_bss_section_information['parent_node_id']);
    }
    /* If this is a development environment, rebuild the minified JS file.
         For the automatic JS minification to occur:
         1. PHP needs write permissions for /js/jjamerson_lc.min.js
         2. The development_environment variable needs to be defined. You can do this
            either in a local settings file (e.g. settings.local.php) or via a drush command:
            drush vset development_environment 1
      */
    $dev_env = variable_get('development_environment');
    if ($dev_env == 1) {
        //require_once drupal_get_path('theme', $base_theme) . '/third-party/class.JavaScriptPacker.php';
        $source = '';
        if ($directory_handle = opendir(dirname(__FILE__) . '/js/source')) {
            while (($file = readdir($directory_handle)) !== false) {
                // Only load JS extensions. This prevents issues with the packer loading .DS_Store files, at the least.
                if (substr($file, -3) === '.js') {
                    $source .= file_get_contents(dirname(__FILE__) . '/js/source/' . $file) . "\n";
                }
            }
            closedir($directory_handle);
        }
        $packer = new JavaScriptPacker($source, 'None', true, false);
        $packed = $packer->pack();
        file_put_contents(dirname(__FILE__) . '/js/jjamerson_lc.min.js', $packed);
    } elseif ($dev_env == 2) {
        /* Alternatively, just add each JS file via drupal_add_js. Better for hunting down errors because
           the console will tell you the offending file & line number: */
        if ($directory_handle = opendir(dirname(__FILE__) . '/js/source')) {
            while (($file = readdir($directory_handle)) !== false) {
                if (preg_match('/.js$/', $file)) {
                    drupal_add_js(path_to_theme() . '/js/source/' . $file);
                }
            }
            closedir($directory_handle);
        }
    }
    if (drupal_is_front_page()) {
        drupal_add_js('//maps.googleapis.com/maps/api/js?libraries=geometry', array('type' => 'external'));
        // VideoJS components:
        drupal_add_js('//vjs.zencdn.net/4.12/video.js', array('type' => 'external', 'scope' => 'footer'));
        drupal_add_css('//vjs.zencdn.net/4.12/video-js.css', array('type' => 'external'));
    }
    /* Allows you to use node-type, and node ID base page templates: */
    if (!empty($variables['node'])) {
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
        $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->vid;
    } elseif (drupal_get_http_header('status')) {
        $variables['theme_hook_suggestions'][] = 'page__404';
    }
    /* Place logo: */
    if (isset($_GET['render-only']) && isset($_GET['unlink-logo'])) {
        $logo = "<img src='{$variables['logo']}' alt='Berklee logo' id='logo'>";
    } else {
        $logo = l("<img src='{$variables['logo']}' alt='Berklee Logo' title='Berklee Homepage'>", $base_url . $base_path, array('attributes' => array('id' => 'logo', 'rel' => 'home', 'title' => t('Home'), 'tabindex' => '1'), 'html' => TRUE));
    }
    $logo_array = array('logo' => array('#markup' => $logo, '#type' => 'markup', '#weight' => -100));
    $share_links = array('share_links' => array('#markup' => '<div class="share-holder">
          <!-- AddThis Button BEGIN -->
          <div class="addthis_toolbox addthis_default_style ">
          <a class="addthis_button_facebook_like at300b" fb:like:layout="button_count"></a>
          <a class="addthis_counter addthis_pill_style"></a>
          </div>
          <script type="text/javascript">var addthis_config = {"data_track_addressbar":false};</script>
          <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fbe4da869545ef5"></script>
          <!-- AddThis Button END -->
        </div>', '#type' => 'markup', '#weight' => 1001));
    if (isset($variables['page']['header']) && is_array($variables['page']['header'])) {
        $variables['page']['header'] = $logo_array + $variables['page']['header'] + $share_links;
    }
    /* Add a pretitle page variable, primarily for the sponsorship field */
    $variables['pretitle'] = '';
    if ($variables['page']['#type'] === 'page' && isset($variables['node'])) {
        if (isset($variables['node']->field_sponsorship) && count($variables['node']->field_sponsorship)) {
            $variables['pretitle'] = $variables['node']->field_sponsorship[$lang][0]['safe_value'];
            $variables['pretitle'] = "<span class='pretitle'>{$variables['pretitle']}</span>";
        }
    }
    /* Add a subtitle page variable */
    $variables['subtitle'] = '';
    if (isset($variables['node']) && $variables['node']->type === 'bt_cover') {
        $variables['pretitle'] = "<span class='pretitle previous-link'>";
        $variables['pretitle'] .= "<a href='/alumni'>Alumni Affairs</a>/";
        $variables['pretitle'] .= "<a href='/berklee-today/archives'>See All BT Issues</a>";
        $variables['pretitle'] .= "</span>";
        $variables['subtitle'] = "<span class='subtitle'>A Magazine for Contemporary Music and Musicians</span>";
    }
    if (isset($variables['node']) && $variables['node']->type === 'bt_article') {
        if (isset($variables['page']['sidebar_first']['berklee_site_section_breadcrumb'])) {
            $new_crumb = '<ul class="breadcrumb"><li><a href="/alumni">Alumni Affairs</a></li><li><a href="/berklee-today/archives">All BT Issues</a></li></ul>';
            $variables['page']['sidebar_first']['berklee_site_section_breadcrumb']['#markup'] = $new_crumb;
        }
    }
    if (isset($variables['theme_hook_suggestions'][0]) && $variables['theme_hook_suggestions'][0] == 'page__directory') {
        $variables['title'] = 'Berklee Directory';
        $variables['subtitle'] = "<span class='subtitle'>Faculty, Staff, and Departments</span>";
    }
    /* Return unformatted content if notemplate variable is defined */
    if (isset($_GET['content-only'])) {
        unset($variables['page']['header']);
        unset($variables['page']['top_nav']);
        unset($variables['page']['offscreen_sidebar']);
        unset($variables['page']['offscreen_overlay']);
        unset($variables['page']['sidebar_first']);
        unset($variables['page']['sidebar_second']);
        unset($variables['page']['content']['berklee_info_block_berklee_info_block']);
        unset($variables['page']['page_top']);
        unset($variables['page']['page_bottom']);
        unset($variables['page']['footer']);
        /* check if this is an ajax request. if so, return just the page content: */
        if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            echo drupal_render($variables['page']['content']);
            echo drupal_render($variables['page']['content_bottom']);
            die;
        }
    }
    // Check to see if this page can be used as a lead page:
    if (isset($site_section->field_base_url) && isset($site_section->field_banner_image_large[$lang][0]['uri']) && $site_section->description) {
        $site_section_home = $site_section->field_base_url[$lang][0]['value'];
        if (drupal_get_path_alias() == $site_section_home) {
            $header_image = $site_section->field_banner_image_large[$lang][0]['uri'];
            $header_image_src = file_create_url($header_image);
            // store the image source in an array element in the header, to be used by marshall_preprocess_region()
            // to set the background image:
            $variables['page']['header']['#lead-page']['header-image'] = $header_image_src;
            $summary = $site_section->description;
            $header_copy = "<div class='lead-page-intro'><h1>{$site_section->name}</h1><div class='lead-page-summary'>{$summary}</div></div>";
            $header_copy_array = array('lead-page-intro' => array('#markup' => $header_copy, '#type' => 'markup', '#weight' => -100));
            $variables['page']['header'] += $header_copy_array;
        }
    }
}