| 1 |
<?php
|
| 2 |
/** Define the regions **/
|
| 3 |
function light_regions() {
|
| 4 |
return array(
|
| 5 |
'sidebar' => t('sidebar'),
|
| 6 |
'content' => t('content'),
|
| 7 |
'header' => t('header'),
|
| 8 |
'footer' => t('footer'),
|
| 9 |
);
|
| 10 |
}
|
| 11 |
|
| 12 |
//custom primary links
|
| 13 |
//see http://drupal.org/node/168353
|
| 14 |
/**
|
| 15 |
* catches the theme_links function and calls back a link.tpl.php file to determine the layout
|
| 16 |
*/
|
| 17 |
/*
|
| 18 |
function phptemplate_links($links = array(), $attributes = array('class' => 'links'))
|
| 19 |
{
|
| 20 |
return _phptemplate_callback('links', array('links' => $links, 'attributes' => $attributes));
|
| 21 |
}
|
| 22 |
*/
|
| 23 |
|
| 24 |
// split out taxonomy terms by vocabulary
|
| 25 |
//see http://drupal.org/node/133223
|
| 26 |
function light_print_terms($nid) {
|
| 27 |
$vocabularies = taxonomy_get_vocabularies();
|
| 28 |
$output = '';
|
| 29 |
foreach($vocabularies as $vocabulary) {
|
| 30 |
if ($vocabularies) {
|
| 31 |
$terms = taxonomy_node_get_terms_by_vocabulary($nid, $vocabulary->vid);
|
| 32 |
if ($terms) {
|
| 33 |
$links = array();
|
| 34 |
//$output .= '' . $vocabulary->name . ': ';
|
| 35 |
foreach ($terms as $term) {
|
| 36 |
$links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
|
| 37 |
}
|
| 38 |
$output .= implode(', ', $links);
|
| 39 |
}
|
| 40 |
}
|
| 41 |
}
|
| 42 |
|
| 43 |
return $output;
|
| 44 |
}
|
| 45 |
|
| 46 |
//Hack to ensure primary menu (the active item) stays highlighted when a secondary item is selested
|
| 47 |
//see http://drupal.org/node/140491
|
| 48 |
function phptemplate_light_primarylinks($links, $attributes = array('class' => 'links')) {
|
| 49 |
$output = '';
|
| 50 |
|
| 51 |
if (count($links) > 0) {
|
| 52 |
$output = '<ul'. drupal_attributes($attributes) .'>';
|
| 53 |
|
| 54 |
$num_links = count($links);
|
| 55 |
$i = 1;
|
| 56 |
|
| 57 |
foreach ($links as $key => $link) {
|
| 58 |
$class = '';
|
| 59 |
|
| 60 |
// Automatically add a class to each link and also to each LI
|
| 61 |
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
|
| 62 |
$link['attributes']['class'] .= ' ' . $key;
|
| 63 |
$class = $key;
|
| 64 |
}
|
| 65 |
else {
|
| 66 |
$link['attributes']['class'] = $key;
|
| 67 |
$class = $key;
|
| 68 |
}
|
| 69 |
|
| 70 |
$explode_array = explode('-',$link['attributes']['class']);
|
| 71 |
if(count($explode_array)== 5)
|
| 72 |
{
|
| 73 |
array_push($explode_array,'active');
|
| 74 |
$link['attributes']['class'] = implode('-',$explode_array);
|
| 75 |
$pos = strrpos($link['attributes']['class'], "-");
|
| 76 |
$link['attributes']['class'] = substr_replace($link['attributes']['class'], ' ', $pos, -6);
|
| 77 |
}
|
| 78 |
// Add first and last classes to the list of links to help out themers.
|
| 79 |
$extra_class = '';
|
| 80 |
if ($i == 1) {
|
| 81 |
$extra_class .= 'first ';
|
| 82 |
}
|
| 83 |
if ($i == $num_links) {
|
| 84 |
$extra_class .= 'last ';
|
| 85 |
}
|
| 86 |
$output .= '<li class="'. $extra_class . $class .'">';
|
| 87 |
|
| 88 |
// Is the title HTML?
|
| 89 |
$html = isset($link['html']) && $link['html'];
|
| 90 |
|
| 91 |
// Initialize fragment and query variables.
|
| 92 |
$link['query'] = isset($link['query']) ? $link['query'] : NULL;
|
| 93 |
$link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
|
| 94 |
|
| 95 |
if (isset($link['href'])) {
|
| 96 |
//$output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
|
| 97 |
$output .= l("<span>".$link['title']."</span>", $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, true);
|
| 98 |
}
|
| 99 |
else if ($link['title']) {
|
| 100 |
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
|
| 101 |
if (!$html) {
|
| 102 |
$link['title'] = check_plain($link['title']);
|
| 103 |
}
|
| 104 |
$output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
|
| 105 |
}
|
| 106 |
|
| 107 |
$i++;
|
| 108 |
$output .= "</li>\n";
|
| 109 |
}
|
| 110 |
|
| 111 |
$output .= '</ul>';
|
| 112 |
}
|
| 113 |
|
| 114 |
return $output;
|
| 115 |
}
|
| 116 |
?>
|