Projet

Général

Profil

Paste
Télécharger (2,19 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / kanji / template.php @ 87dbc3bf

1
<?php
2
function kanji_preprocess_page(&$variables) {
3
  if (isset($variables['main_menu'])) {
4
    $pid = variable_get('menu_main_links_source', 'main-menu');
5
    $tree = menu_tree($pid);
6
    $variables['primary_nav'] = str_replace('menu', 'sf-menu menu', drupal_render($tree));
7
  } else {
8
    $variables['primary_nav'] = FALSE;
9
  }
10
}
11

    
12
function kanji_breadcrumb(&$variables) {
13
  $output = '';
14
  $breadcrumb = $variables['breadcrumb'];
15
  $show_breadcrumb = theme_get_setting('breadcrumb_display');
16
  if ($show_breadcrumb == 'yes') {
17
    if (!empty($breadcrumb)) {
18
      // Provide a navigational heading to give context for breadcrumb links to
19
      // screen-reader users. Make the heading invisible with .element-invisible.
20
      $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
21

    
22
      $output .= '<div class="breadcrumb">' . implode(' | ', $breadcrumb) . '</div>';
23
    } else {
24
      $output = '<div class="breadcrumb">' . t('Home') . '</div>';
25
    }
26
  }
27
  return $output;
28
}
29

    
30
function kanji_feed_icon(&$variables) {
31
  $text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title']));
32
  if ($image = theme('image', array('path' => path_to_theme() . '/images/rss.png', 'alt' => $text))) {
33
    return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text)));
34
  }
35
}
36

    
37
function kanji_preprocess_html(&$variables) {
38
  // Add conditional stylesheets for IE
39
  drupal_add_css(path_to_theme() . '/ie_styles.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE', '!IE' => FALSE), 'preprocess' => FALSE));
40
  global $base_url;
41
  // Add background
42
  if (theme_get_setting('default_background') == 1) {
43
    $variables['background'] = 'background-image: url(\'' . $base_url . '/' . path_to_theme() . '/images/bg.jpg\')'; 
44
  }
45
  elseif (theme_get_setting('background_color') && theme_get_setting('background_color_value')) {
46
    $variables['background'] = 'background: #' . theme_get_setting('background_color_value');
47
  }
48
  elseif (theme_get_setting('path_background')) {
49
    $bg = variable_get('kanji:path_background', '');
50
    $bg = file_create_url($bg);
51
    $variables['background'] = 'background-image: url(\'' . $bg . '\')';
52
  }
53
}