template.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /**
  3. * Override of theme_breadcrumb().
  4. */
  5. function garland_breadcrumb($variables) {
  6. $breadcrumb = $variables['breadcrumb'];
  7. if (!empty($breadcrumb)) {
  8. // Provide a navigational heading to give context for breadcrumb links to
  9. // screen-reader users. Make the heading invisible with .element-invisible.
  10. $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
  11. $output .= '<div class="breadcrumb">' . implode(' › ', $breadcrumb) . '</div>';
  12. return $output;
  13. }
  14. }
  15. /**
  16. * Override or insert variables into the maintenance page template.
  17. */
  18. function garland_preprocess_maintenance_page(&$variables) {
  19. // While markup for normal pages is split into page.tpl.php and html.tpl.php,
  20. // the markup for the maintenance page is all in the single
  21. // maintenance-page.tpl.php template. So, to have what's done in
  22. // garland_preprocess_html() also happen on the maintenance page, it has to be
  23. // called here.
  24. garland_preprocess_html($variables);
  25. }
  26. /**
  27. * Override or insert variables into the html template.
  28. */
  29. function garland_preprocess_html(&$variables) {
  30. // Toggle fixed or fluid width.
  31. if (theme_get_setting('garland_width') == 'fluid') {
  32. $variables['classes_array'][] = 'fluid-width';
  33. }
  34. // Add conditional CSS for IE6.
  35. drupal_add_css(path_to_theme() . '/fix-ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
  36. }
  37. /**
  38. * Override or insert variables into the html template.
  39. */
  40. function garland_process_html(&$variables) {
  41. // Hook into color.module
  42. if (module_exists('color')) {
  43. _color_html_alter($variables);
  44. }
  45. }
  46. /**
  47. * Override or insert variables into the page template.
  48. */
  49. function garland_preprocess_page(&$variables) {
  50. // Move secondary tabs into a separate variable.
  51. $variables['tabs2'] = array(
  52. '#theme' => 'menu_local_tasks',
  53. '#secondary' => $variables['tabs']['#secondary'],
  54. );
  55. unset($variables['tabs']['#secondary']);
  56. if (isset($variables['main_menu'])) {
  57. $variables['primary_nav'] = theme('links__system_main_menu', array(
  58. 'links' => $variables['main_menu'],
  59. 'attributes' => array(
  60. 'class' => array('links', 'inline', 'main-menu'),
  61. ),
  62. 'heading' => array(
  63. 'text' => t('Main menu'),
  64. 'level' => 'h2',
  65. 'class' => array('element-invisible'),
  66. )
  67. ));
  68. }
  69. else {
  70. $variables['primary_nav'] = FALSE;
  71. }
  72. if (isset($variables['secondary_menu'])) {
  73. $variables['secondary_nav'] = theme('links__system_secondary_menu', array(
  74. 'links' => $variables['secondary_menu'],
  75. 'attributes' => array(
  76. 'class' => array('links', 'inline', 'secondary-menu'),
  77. ),
  78. 'heading' => array(
  79. 'text' => t('Secondary menu'),
  80. 'level' => 'h2',
  81. 'class' => array('element-invisible'),
  82. )
  83. ));
  84. }
  85. else {
  86. $variables['secondary_nav'] = FALSE;
  87. }
  88. // Prepare header.
  89. $site_fields = array();
  90. if (!empty($variables['site_name'])) {
  91. $site_fields[] = $variables['site_name'];
  92. }
  93. if (!empty($variables['site_slogan'])) {
  94. $site_fields[] = $variables['site_slogan'];
  95. }
  96. $variables['site_title'] = implode(' ', $site_fields);
  97. if (!empty($site_fields)) {
  98. $site_fields[0] = '<span>' . $site_fields[0] . '</span>';
  99. }
  100. $variables['site_html'] = implode(' ', $site_fields);
  101. // Set a variable for the site name title and logo alt attributes text.
  102. $slogan_text = $variables['site_slogan'];
  103. $site_name_text = $variables['site_name'];
  104. $variables['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
  105. }
  106. /**
  107. * Override or insert variables into the node template.
  108. */
  109. function garland_preprocess_node(&$variables) {
  110. $variables['submitted'] = $variables['date'] . ' — ' . $variables['name'];
  111. }
  112. /**
  113. * Override or insert variables into the comment template.
  114. */
  115. function garland_preprocess_comment(&$variables) {
  116. $variables['submitted'] = $variables['created'] . ' — ' . $variables['author'];
  117. }
  118. /**
  119. * Override or insert variables into the block template.
  120. */
  121. function garland_preprocess_block(&$variables) {
  122. $variables['title_attributes_array']['class'][] = 'title';
  123. $variables['classes_array'][] = 'clearfix';
  124. }
  125. /**
  126. * Override or insert variables into the page template.
  127. */
  128. function garland_process_page(&$variables) {
  129. // Hook into color.module
  130. if (module_exists('color')) {
  131. _color_page_alter($variables);
  132. }
  133. }
  134. /**
  135. * Override or insert variables into the region template.
  136. */
  137. function garland_preprocess_region(&$variables) {
  138. if ($variables['region'] == 'header') {
  139. $variables['classes_array'][] = 'clearfix';
  140. }
  141. }