Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Preprocessor for page.tpl.php template file.
*/
function bluecheese_preprocess_page(&$variables) {
// Add HTML tag name for title tag.
$variables['site_name_element'] = $variables['is_front'] ? 'h1' : 'div';
// Add variable for site status message (for development sites).
$variables['drupalorg_site_status'] = filter_xss_admin(variable_get('drupalorg_site_status', FALSE));
}
/**
* Implementation of template_preprocess_node().
*/
function bluecheese_preprocess_node(&$variables) {
// Modify 'Submitted by' text on nodes
$variables['date'] = format_date($variables['node']->created, 'custom', 'F j, Y \a\t g:ia');
$variables['pubdate'] = '<time pubdate datetime="' . $variables['node']->created . '">' . $variables['date'] . '</time>';
$variables['submitted'] = t('Posted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['pubdate']));
}
/**
* Process variables for aggregator-item.tpl.php.
*
* @see aggregator-item.tpl.php
*/
function bluecheese_preprocess_aggregator_item(&$variables) {
// Modify 'Posted on' date
$variables['source_date'] = format_date($variables['item']->timestamp, 'custom', 'F j, Y \a\t g:ia');
// Hide 'Drupal Planet' category on Planet posts
foreach ($variables['categories'] as $key => $category) {
if (strpos($category, 'class="active"') !== FALSE) {
unset($variables['categories'][$key]);
}
}
}
/**
* Implements hook_css_alter().
*
* Remove core & module CSS files we don't want in our theme
*/
function bluecheese_css_alter(&$css) {
unset($css['modules/forum/forum.css']);
}
/**
* Implements hook_js_alter().
*
* Swap out core js & module js we don't want in our theme
*/
function bluecheese_js_alter(&$javascript) {
// We provide our own vertical tabs js so that we can disable it smaller devices.
if (isset($javascript['misc/vertical-tabs.js'])) {
$javascript['misc/vertical-tabs.js']['data'] = drupal_get_path('theme', 'bluecheese') . '/js/vertical-tabs.js';
}
/**
* Theme local tasks, so a primary item is not active if we have active in the secondary ones.
*/
function bluecheese_menu_local_tasks(&$variables) {
$output = '';
if (!empty($variables['primary'])) {
$variables['primary']['#prefix'] = '<h2 class="element-invisible">' . t('Primary tabs') . '</h2>';
$variables['primary']['#prefix'] .= '<ul class="tabs primary clearfix">';
$variables['primary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['primary']);
// Admitted, this is a total hack. If we have any secondary local tasks,
// there shold be no class="active" item in the primary local tasks,
// because it is not "directly" active. So replace with class="parent-active".
}
if (!empty($variables['secondary'])) {
$output = str_replace('class="active"', 'class="parent-active"', $output);
$variables['secondary']['#prefix'] = '<h2 class="element-invisible">' . t('Secondary tabs') . '</h2>';
$variables['secondary']['#prefix'] .= '<ul class="tabs secondary clearfix">';
$variables['secondary']['#suffix'] = '</ul>';
$output .= drupal_render($variables['secondary']);
}
return $output;
}
/**
* Overrides theme_election_candidate_ballot_item().
*/
function bluecheese_election_candidate_ballot_item($variables) {
$candidate = $variables['candidate'];
$account = user_load($candidate->uid);
$picture = association_drupalorg_candidate_picture($candidate, $account);
$full_name = theme('election_candidate_full_name', array('candidate' => $candidate));
$link = l($picture . $full_name, election_candidate_uri_path($candidate), array('html' => TRUE));
return '<span class="election-candidate-ballot-item">' . $link . ' <span class="username">(' . format_username($account) .')</span></span>';