Example #1
0
/**
 * Implements template_preprocess_zone().
 */
function dkan_preprocess_zone(&$vars)
{
    if (module_exists('context')) {
        $contexts = context_active_contexts();
        // Create a template suggestion if we are in the dataset context.
        if ($vars['zone'] == 'content' && isset($contexts['dataset'])) {
            $vars['theme_hook_suggestions'][] = 'zone__content__dataset';
        } elseif ($vars['zone'] == 'content' && isset($contexts['resource'])) {
            $vars['theme_hook_suggestions'][] = 'zone__content__resource';
        }
    }
}
Example #2
0
function newsweek_set_archive_list_style()
{
    $active_contexts = context_active_contexts();
    $style = "";
    if (arg(0) == "taxonomy" && arg(1) == "term" && is_numeric(arg(2))) {
        $term = taxonomy_term_load(arg(2));
        if ($term->vocabulary_machine_name == "categories" || array_key_exists('green_section_page', $active_contexts)) {
            $style = "box";
        } else {
            $style = "list";
        }
    }
    return $style;
}
/**
 * Implements theme_links__system_main_menu.
 */
function innovation_links__system_main_menu($variables)
{
    $links = $variables['links'];
    $attributes = $variables['attributes'];
    $heading = $variables['heading'];
    $trail = menu_get_active_trail();
    array_shift($trail);
    unset($links['#sorted']);
    unset($links['#theme_wrappers']);
    global $language_url;
    $output = '';
    if (count($links) > 0) {
        $output = '';
        // Treat the heading first if it is present to prepend it to the
        // list of links.
        if (!empty($heading)) {
            if (is_string($heading)) {
                // Prepare the array that will be used when the passed heading
                // is a string.
                $heading = array('text' => $heading, 'level' => 'h2');
            }
            $output .= '<' . $heading['level'];
            if (!empty($heading['class'])) {
                $output .= drupal_attributes(array('class' => $heading['class']));
            }
            $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
        }
        $output .= '<ul' . drupal_attributes($attributes) . '>';
        $num_links = count($links);
        $i = 1;
        foreach ($links as $key => $link) {
            $class = array($key);
            $link['#attributes'] = isset($link['#localized_options']['attributes']) ? $link['#localized_options']['attributes'] : array();
            // Add first/last/active classes to help out themers.
            if ($i == 1) {
                $class[] = 'first';
            }
            if ($i == $num_links) {
                $class[] = 'last';
            }
            if (isset($link['#href']) && ($link['#href'] == $_GET['q'] || $link['#href'] == '<front>' && drupal_is_front_page()) && (empty($link['#language']) || $link['#language']->language == $language_url->language)) {
                $class[] = 'active';
            }
            // Check for, and honor active states set by context menu reactions
            if (module_exists('context')) {
                $contexts = context_active_contexts();
                foreach ($contexts as $context) {
                    if (isset($context->reactions['menu'])) {
                        if ($link['#href'] == $context->reactions['menu']) {
                            $class[] = 'active';
                        }
                    }
                }
            }
            $options['attributes'] = $link['#attributes'];
            // Make list item a dropdown if we have child items.
            if (!empty($link['#below'])) {
                $class[] = 'dropdown';
                $class[] = 'clearfix';
            }
            if (!empty($trail) && isset($trail[0]['mlid']) && $link['#original_link']['mlid'] == $trail[0]['mlid']) {
                $class[] = 'active';
            }
            $output .= '<li' . drupal_attributes(array('class' => $class)) . '>';
            if (isset($link['#href'])) {
                // Pass in $link as $options, they share the same keys.
                $output .= l($link['#title'], $link['#href'], array('attributes' => $link['#attributes']));
            } elseif (!empty($link['#title'])) {
                // Wrap non-<a> links in <span> for adding title and class attributes.
                if (empty($link['#html'])) {
                    $link['#title'] = check_plain($link['#title']);
                }
                $span_attributes = '';
                if (isset($link['#attributes'])) {
                    $span_attributes = drupal_attributes($link['#attributes']);
                }
                $output .= '<span' . $span_attributes . '>' . $link['#title'] . '</span>';
            }
            // If link has child items, print a toggle and dropdown menu.
            if (!empty($link['#below'])) {
                $dropdown_id = 'main-menu-dropdown-' . $i;
                $output .= '<a href="#" class="dropdown-toggle pull-right" data-toggle="dropdown" id="' . $dropdown_id . '"><span class="caret"></span></a>';
                $output .= theme('links__system_main_menu', array('links' => $link['#below'], 'attributes' => array('class' => array('dropdown-menu'), 'role' => 'menu', 'aria-labelledby' => $dropdown_id)));
            }
            $i++;
            $output .= "</li>\n";
        }
        $output .= '</ul>';
    }
    return $output;
}
Example #4
0
<?php

// $Id: page.tpl.php 6635 2010-03-01 00:39:49Z chris $
$curr_contexts = context_active_contexts();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php 
print $language->language;
?>
" xml:lang="<?php 
print $language->language;
?>
">

<head>
  <title><?php 
print $head_title;
?>
</title>
  <?php 
print $head;
?>
  <?php 
print $styles;
?>
  <?php 
print $setting_styles;
?>
  <!--[if IE 8]>
  <?php 
print $ie8_styles;