| 1 |
<?php
|
| 2 |
|
| 3 |
/**
|
| 4 |
* ABOUT
|
| 5 |
*
|
| 6 |
* The template.php file is one of the most useful files when creating or modifying Drupal themes.
|
| 7 |
* You can add new regions for block content, modify or override Drupal's theme functions,
|
| 8 |
* intercept or make additional variables available to your theme, and create custom PHP logic.
|
| 9 |
* For more information, please visit the Theme Developer's Guide on Drupal.org:
|
| 10 |
* http://drupal.org/node/509
|
| 11 |
*/
|
| 12 |
|
| 13 |
|
| 14 |
/**
|
| 15 |
* OVERRIDING THEME FUNCTIONS
|
| 16 |
*
|
| 17 |
* The Drupal theme system uses special theme functions to generate HTML output automatically.
|
| 18 |
* Often we wish to customize this HTML output. To do this, we have to override the theme function.
|
| 19 |
* You have to first find the theme function that generates the output, and then "catch" it and modify it here.
|
| 20 |
* The easiest way to do it is to copy the original function in its entirety and paste it here, changing
|
| 21 |
* the prefix from theme_ to zen_. For example:
|
| 22 |
*
|
| 23 |
* original: theme_breadcrumb()
|
| 24 |
* theme override: aurora_breadcrumb()
|
| 25 |
*
|
| 26 |
* See the following example. In this theme, we want to change all of the breadcrumb separator links from >> to ::
|
| 27 |
*
|
| 28 |
*/
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Return a themed breadcrumb trail.
|
| 32 |
*
|
| 33 |
* @param $breadcrumb
|
| 34 |
* An array containing the breadcrumb links.
|
| 35 |
* @return a string containing the breadcrumb output.
|
| 36 |
*/
|
| 37 |
/* function aurora_breadcrumb($breadcrumb) {
|
| 38 |
if (!empty($breadcrumb)) {
|
| 39 |
return '<div class="breadcrumb">'. implode(' :: ', $breadcrumb) .'</div>';
|
| 40 |
}
|
| 41 |
} */
|
| 42 |
|
| 43 |
|
| 44 |
/**
|
| 45 |
* CREATE OR MODIFY VARIABLES FOR YOUR THEME
|
| 46 |
*
|
| 47 |
* The most powerful function available to themers is the _phptemplate_variables() function. It allows you
|
| 48 |
* to pass newly created variables to different template (tpl.php) files in your theme. Or even unset ones you don't want
|
| 49 |
* to use.
|
| 50 |
*
|
| 51 |
* It works by switching on the hook, or name of the theme function, such as:
|
| 52 |
* - page
|
| 53 |
* - node
|
| 54 |
* - comment
|
| 55 |
* - block
|
| 56 |
*
|
| 57 |
* By switching on this hook you can send different variables to page.tpl.php file, node.tpl.php
|
| 58 |
* (and any other derivative node template file, like node-forum.tpl.php), comment.tpl.php, and block.tpl.php
|
| 59 |
*
|
| 60 |
*/
|
| 61 |
|
| 62 |
|
| 63 |
function aurora_preprocess_node(&$vars) {
|
| 64 |
// Send a new variable, $has_terms, to see wether the current node has any terms
|
| 65 |
$vars['has_terms'] = count(taxonomy_node_get_terms($vars['node'])) > 0;
|
| 66 |
return $vars;
|
| 67 |
}
|
| 68 |
|
| 69 |
function aurora_tabs($tabs, $attributes = array()) {
|
| 70 |
$attributes['class'] .= ' tabs';
|
| 71 |
$out = '<ul class="tabs">';
|
| 72 |
foreach ($tabs as $tab) $out .= theme('menu_local_task', theme('menu_item_link', $tab));
|
| 73 |
$out .= '</ul>';
|
| 74 |
return $out;
|
| 75 |
}
|