Exemple #1
0
/**
 * Preprocessor for theme_page().
 */
function ginkgo_preprocess_page(&$vars)
{
    // Add icon markup to main menu
    ginkgo_icon_links($vars['primary_links']);
    // If tabs are active, the title is likely shown in them. Don't show twice.
    $vars['title'] = !empty($vars['tabs']) ? '' : $vars['title'];
    // Respect anything people are requesting through context.
    if (module_exists('context')) {
        $vars['custom_layout'] = context_get('theme', 'layout') == 'custom' ? TRUE : FALSE;
        $vars['attr']['class'] .= context_isset('theme', 'body_classes') ? " " . context_get('theme', 'body_classes') : '';
    }
    // Add a smarter body class than "not logged in" for determining whether
    // we are on a login/password/user registration related page.
    global $user;
    $vars['mission'] = '';
    if (!$user->uid && arg(0) == 'user') {
        $vars['attr']['class'] .= ' anonymous-login';
        $vars['mission'] = filter_xss_admin(variable_get('site_mission', ''));
    }
    // Theme specific settings
    $settings = theme_get_settings('ginkgo');
    // Show site title/emblem ?
    $vars['site_name'] = isset($settings['emblem']) && !$settings['emblem'] ? '' : $vars['site_name'];
    // Footer links
    $vars['footer_links'] = isset($vars['footer_links']) ? $vars['footer_links'] : array();
    $item = menu_get_item('admin');
    if ($item && $item['access']) {
        $vars['footer_links']['admin'] = $item;
    }
    // IE7 CSS
    // @TODO: Implement IE styles key in tao.
    $ie = base_path() . path_to_theme() . '/ie.css';
    $vars['ie'] = "<!--[if lte IE 8]><style type='text/css' media='screen'>@import '{$ie}';</style><![endif]-->";
    // Add spaces design CSS back in
    if (!isset($_GET['print'])) {
        if (empty($vars['spaces_design_styles'])) {
            global $theme_info;
            $space = spaces_get_space();
            // Retrieve default colors from info file
            if (isset($theme_info->info["spaces_design_{$space->type}"])) {
                $default = $theme_info->info["spaces_design_{$space->type}"];
            } else {
                $default = '#3399aa';
            }
            $color = !empty($settings["color_{$space->type}"]) ? $settings["color_{$space->type}"] : $default;
            $vars['styles'] .= theme('spaces_design', $color);
            $vars['attr']['class'] .= ' spaces-design';
        } else {
            $vars['styles'] .= $vars['spaces_design_styles'];
        }
    }
}
Exemple #2
0
/**
 * Preprocessor for theme_page().
 */
function ginkgo_preprocess_page(&$vars)
{
    // Add icon markup to main menu
    ginkgo_icon_links($vars['primary_links']);
    // Grab the header dropdown links
    $vars['header'] = theme('blocks_header', array());
    $vars['dropdown_links'] = theme('blocks_header', array(), TRUE);
    // If tabs are active, the title is likely shown in them. Don't show twice.
    $vars['title'] = !empty($vars['tabs']) ? '' : $vars['title'];
    // Respect anything people are requesting through context.
    if (module_exists('context')) {
        if (context_get('theme', 'layout') == 'custom') {
            $vars['custom_layout'] = TRUE;
        }
        if ($classes = context_get('theme', 'body_classes')) {
            $vars['attr']['class'] .= " {$classes}";
        }
    }
    // Add a smarter body class than "not logged in" for determining whether
    // we are on a login/password/user registration related page.
    global $user;
    $vars['mission'] = '';
    if (!$user->uid && arg(0) == 'user') {
        $vars['attr']['class'] .= ' anonymous-login';
        $vars['mission'] = filter_xss_admin(variable_get('site_mission', ''));
    }
    // Theme specific settings
    $settings = theme_get_settings('ginkgo');
    // Show site title/emblem ?
    if (isset($settings['emblem']) && !$settings['emblem']) {
        $vars['site_name'] = '';
    }
    // Add spaces design CSS back in
    if (empty($vars['spaces_design_styles'])) {
        global $theme_info;
        $space = spaces_get_space();
        // Retrieve default colors from info file
        if (isset($theme_info->info["spaces_design_{$space->type}"])) {
            $default = $theme_info->info["spaces_design_{$space->type}"];
        } else {
            $default = '#3399aa';
        }
        $color = !empty($settings["color_{$space->type}"]) ? $settings["color_{$space->type}"] : $default;
        $vars['styles'] .= theme('spaces_design', $color);
        $vars['attr']['class'] .= ' spaces-design';
    } else {
        $vars['styles'] .= $vars['spaces_design_styles'];
    }
}
Exemple #3
0
/**
 * Preprocessor for theme_page().
 */
function ginkgo_preprocess_page(&$vars) {
  // Switch layout for 404/403 pages.
  $headers = drupal_get_headers();
  if ((strpos($headers, 'HTTP/1.1 403 Forbidden') !== FALSE) || strpos($headers, 'HTTP/1.1 404 Not Found') !== FALSE) {
    $vars['template_files'][] = 'layout-wide';
  }

  // Add body class for layout.
  $vars['attr']['class'] .= !empty($vars['template_files']) ? ' '. end($vars['template_files']) : '';

  // Don't show the navigation in the admin section.
  // Otherwise add icon markup to main menu.
  if (arg(0) === 'admin') {
    $vars['primary_links'] = '';
  }
  else {
    ginkgo_icon_links($vars['primary_links']);
  }

  // If tabs are active, the title is likely shown in them. Don't show twice.
  $vars['title_attr'] = array('class' => 'page-title');
  $vars['title_attr']['class'] .= (!empty($vars['tabs']) || menu_get_object()) ? ' page-title-hidden' : '';

  // Show mission text on login page for anonymous users.
  global $user;
  $vars['mission'] = (!$user->uid && arg(0) == 'user') ? filter_xss_admin(variable_get('site_mission', '')) : '';

  // Fallback logo.
  $vars['logo'] = !empty($vars['logo']) ? $vars['logo'] : l(check_plain(variable_get('site_name', 'Drupal')), '<front>', array('attributes' => array('class' => 'logo')));

  // Footer links
  $vars['footer_links'] = isset($vars['footer_links']) ? $vars['footer_links'] : array();
  $item = menu_get_item('admin');
  if ($item && $item['access']) {
    $vars['footer_links']['admin'] = $item;
  }

  // IE7 CSS
  // @TODO: Implement IE styles key in tao.
  $ie = base_path() . drupal_get_path('theme', 'ginkgo') .'/ie.css';
  $vars['ie'] = "<!--[if lte IE 8]><style type='text/css' media='screen'>@import '{$ie}';</style><![endif]-->";

  // Help text toggler link.
  $vars['help_toggler'] = !empty($vars['help']) ? l(t('Help'), $_GET['q'], array('fragment' => 'block-atrium-help', 'attributes' => array('id' => 'help-toggler', 'class' => 'palette-toggle'))) : '';
}