template.php

Functions

Namesort descending Description
eldir_css_alter Implements hook_css_alter(). @TODO: Do this in .info once http://drupal.org/node/575298 is committed.
eldir_preprocess_html
eldir_preprocess_node Preprocessor for theme_node().
eldir_preprocess_page Preprocessor for theme_page().

File

template.php
View source
  1. <?php
  2. /**
  3. * Preprocessor for theme_page().
  4. */
  5. function eldir_preprocess_page(&$variables, $hook) {
  6. // Prepare the svg URL
  7. if (strpos($variables['logo'], 'eldir')) {
  8. $variables['svg_logo'] = str_replace('logo.png', 'images-source/aegir_logo_horizontal.svg', $variables['logo']);
  9. }
  10. // Overlay is enabled.
  11. $variables['overlay'] = (module_exists('overlay') && overlay_get_mode() === 'child');
  12. $variables['tabs2'] = $variables['tabs'];
  13. unset($variables['tabs']['#secondary']);
  14. unset($variables['tabs2']['#primary']);
  15. // Move the local actions into place of the secondary tabs, for now.
  16. if (is_array($variables['action_links'])) {
  17. foreach ($variables['action_links'] as $link) {
  18. $variables['tabs2']['#secondary'][] = $link;
  19. $variables['tabs2']['#theme'] = 'menu_local_tasks';
  20. }
  21. $variables['action_links']['#access'] = FALSE;
  22. }
  23. if (!isset($variables['title'])) {
  24. $variables['title'] = isset($variables['node']) ? $variables['node']->title : drupal_get_title();
  25. }
  26. $node = menu_get_object();
  27. if (!empty($node) && !$variables['overlay']) {
  28. // Add a node type label on node pages to help users.
  29. $types = node_type_get_types();
  30. $type = $node->type;
  31. if (!empty($types[$type])) {
  32. $variables['title'] = "<span class='label'>{$types[$type]->name}</span>" . $variables['title'];
  33. }
  34. }
  35. }
  36. /**
  37. * Implements hook_css_alter().
  38. * @TODO: Do this in .info once http://drupal.org/node/575298 is committed.
  39. */
  40. function eldir_css_alter(&$css) {
  41. if (isset($css['modules/overlay/overlay-child.css'])) {
  42. $css['modules/overlay/overlay-child.css']['data'] = drupal_get_path('theme', 'eldir') . '/overlay-child.css';
  43. }
  44. }
  45. function eldir_preprocess_html(&$variables, $hook) {
  46. $node = menu_get_object();
  47. if (!empty($node)) {
  48. $type = $node->type;
  49. $variables['classes_array'][] = " node-page";
  50. $variables['classes_array'][] = " ntype-{$type}";
  51. }
  52. // Add path-based class for a last line of defense
  53. $current_path = current_path();
  54. if (!empty($current_path)) {
  55. $variables['classes_array'][] = ' path-' . drupal_html_class(current_path());
  56. }
  57. // Add special body class for error pages
  58. # if (menu_get_active_item() === 0) {
  59. # $variables['body_classes'] .= ' error-page';
  60. # }
  61. }
  62. /**
  63. * Preprocessor for theme_node().
  64. */
  65. function eldir_preprocess_node(&$variables, $hook) {
  66. if (!empty($variables['node'])) {
  67. // Add a node type label on node pages to help users.
  68. $types = node_type_get_types();
  69. $type = $variables['node']->type;
  70. if (!empty($types[$type])) {
  71. $variables['title'] = "<span class='label'>{$types[$type]->name}</span>" . $variables['title'];
  72. }
  73. }
  74. }