template.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * Override or insert variables into the maintenance page template.
  4. */
  5. function gui7_preprocess_maintenance_page(&$vars) {
  6. // While markup for normal pages is split into page.tpl.php and html.tpl.php,
  7. // the markup for the maintenance page is all in the single
  8. // maintenance-page.tpl.php template. So, to have what's done in
  9. // gui7_preprocess_html() also happen on the maintenance page, it has to be
  10. // called here.
  11. gui7_preprocess_html($vars);
  12. }
  13. /**
  14. * Override or insert variables into the html template.
  15. */
  16. function gui7_preprocess_html(&$vars) {
  17. // Add conditional CSS for IE8 and below.
  18. // drupal_add_css(path_to_theme() . '/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
  19. // Add conditional CSS for IE6.
  20. // drupal_add_css(path_to_theme() . '/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
  21. }
  22. /**
  23. * Override or insert variables into the page template.
  24. */
  25. function gui7_preprocess_page(&$vars) {
  26. $vars['primary_local_tasks'] = $vars['tabs'];
  27. unset($vars['primary_local_tasks']['#secondary']);
  28. $vars['secondary_local_tasks'] = array(
  29. '#theme' => 'menu_local_tasks',
  30. '#secondary' => $vars['tabs']['#secondary'],
  31. );
  32. }
  33. /**
  34. * Display the list of available node types for node creation.
  35. */
  36. function gui7_node_add_list($variables) {
  37. $content = $variables['content'];
  38. $output = '';
  39. if ($content) {
  40. $output = '<ul class="admin-list">';
  41. foreach ($content as $item) {
  42. $output .= '<li class="clearfix">';
  43. $output .= '<span class="label">' . l($item['title'], $item['href'], $item['localized_options']) . '</span>';
  44. $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
  45. $output .= '</li>';
  46. }
  47. $output .= '</ul>';
  48. }
  49. else {
  50. $output = '<p>' . t('You have not created any content types yet. Go to the <a href="@create-content">content type creation page</a> to add a new content type.', array('@create-content' => url('admin/structure/types/add'))) . '</p>';
  51. }
  52. return $output;
  53. }
  54. /**
  55. * Overrides theme_admin_block_content().
  56. *
  57. * Use unordered list markup in both compact and extended mode.
  58. */
  59. function gui7_admin_block_content($variables) {
  60. $content = $variables['content'];
  61. $output = '';
  62. if (!empty($content)) {
  63. $output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
  64. foreach ($content as $item) {
  65. $output .= '<li class="leaf">';
  66. $output .= l($item['title'], $item['href'], $item['localized_options']);
  67. if (isset($item['description']) && !system_admin_compact_mode()) {
  68. $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
  69. }
  70. $output .= '</li>';
  71. }
  72. $output .= '</ul>';
  73. }
  74. return $output;
  75. }
  76. /**
  77. * Override of theme_tablesort_indicator().
  78. *
  79. * Use our own image versions, so they show up as black and not gray on gray.
  80. */
  81. function gui7_tablesort_indicator($variables) {
  82. $style = $variables['style'];
  83. $theme_path = drupal_get_path('theme', 'seven');
  84. if ($style == 'asc') {
  85. return theme('image', array('path' => $theme_path . '/images/arrow-asc.png', 'alt' => t('sort ascending'), 'width' => 13, 'height' => 13, 'title' => t('sort ascending')));
  86. }
  87. else {
  88. return theme('image', array('path' => $theme_path . '/images/arrow-desc.png', 'alt' => t('sort descending'), 'width' => 13, 'height' => 13, 'title' => t('sort descending')));
  89. }
  90. }
  91. /**
  92. * Implements hook_css_alter().
  93. */
  94. function gui7_css_alter(&$css) {
  95. // Use Seven's vertical tabs style instead of the default one.
  96. if (isset($css['misc/vertical-tabs.css'])) {
  97. $css['misc/vertical-tabs.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs.css';
  98. }
  99. if (isset($css['misc/vertical-tabs-rtl.css'])) {
  100. $css['misc/vertical-tabs-rtl.css']['data'] = drupal_get_path('theme', 'seven') . '/vertical-tabs-rtl.css';
  101. }
  102. // Use Seven's jQuery UI theme style instead of the default one.
  103. if (isset($css['misc/ui/jquery.ui.theme.css'])) {
  104. $css['misc/ui/jquery.ui.theme.css']['data'] = drupal_get_path('theme', 'seven') . '/jquery.ui.theme.css';
  105. }
  106. }