blockify.theme.inc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * @file
  4. * Theme functions for the Blockify module.
  5. */
  6. /**
  7. * Returns the rendered logo.
  8. *
  9. * @ingroup themeable
  10. */
  11. function theme_blockify_logo($variables) {
  12. $site_name = filter_xss_admin(variable_get('site_name', 'Drupal'));
  13. // Strip the base_path from the beginning of the logo path.
  14. $path = preg_replace('|^' . base_path() . '|', '', $variables['logo_path']);
  15. $image = array(
  16. '#theme' => 'image',
  17. '#path' => $path,
  18. '#alt' => t('!site_name logo', array(
  19. '!site_name' => $site_name,
  20. ))
  21. );
  22. return l(render($image), '<front>', array(
  23. 'html' => TRUE,
  24. 'attributes' => array(
  25. 'id' => 'logo',
  26. 'rel' => 'home',
  27. 'title' => t('Return to the !site_name home page', array(
  28. '!site_name' => $site_name,
  29. )),
  30. ),
  31. ));
  32. }
  33. /**
  34. * Returns the rendered site name.
  35. *
  36. * @ingroup themeable
  37. */
  38. function theme_blockify_site_name($variables) {
  39. $title = drupal_get_title();
  40. $site_name = $variables['site_name'];
  41. // If there is no page title set for this page, use an h1 for the site name.
  42. $tag = ($title !== '') ? 'span' : 'h1';
  43. $link = array(
  44. '#theme' => 'link',
  45. '#path' => '<front>',
  46. '#text' => '<span>' . $site_name . '</span>',
  47. '#prefix' => '<' . $tag . ' id="site-name">',
  48. '#suffix' => '</' . $tag . '>',
  49. '#options' => array(
  50. 'attributes' => array(
  51. 'title' => t('Return to the !site_name home page', array(
  52. '!site_name' => $site_name,
  53. )),
  54. 'rel' => 'home',
  55. ),
  56. 'html' => TRUE,
  57. ),
  58. );
  59. return render($link);
  60. }
  61. /**
  62. * Returns the rendered site slogan.
  63. *
  64. * @ingroup themeable
  65. */
  66. function theme_blockify_site_slogan($variables) {
  67. return '<span class="site-slogan">' . $variables['site_slogan'] . '</span>';
  68. }
  69. /**
  70. * Returns the rendered page title.
  71. *
  72. * @ingroup themeable
  73. */
  74. function theme_blockify_page_title($variables) {
  75. if ($variables['page_title'] !== '') {
  76. $title_attributes_array = array(
  77. 'class' => array('title'),
  78. 'id' => array('page-title'),
  79. );
  80. $title_attributes = drupal_attributes($title_attributes_array);
  81. return '<h1' . $title_attributes . '>' . $variables['page_title'] . '</h1>';
  82. }
  83. }
  84. /**
  85. * Returns the rendered breadcrumb.
  86. *
  87. * @ingroup themeable
  88. */
  89. function theme_blockify_breadcrumb($variables) {
  90. return theme('breadcrumb', $variables);
  91. }
  92. /**
  93. * Returns the rendered action items.
  94. *
  95. * @ingroup themeable
  96. */
  97. function theme_blockify_local_actions($variables) {
  98. $actions = render($variables['menu_local_actions']);
  99. if (!empty($actions)) {
  100. return '<ul class="action-links" class="clearfix">' . $actions . '</ul>';
  101. }
  102. }
  103. /**
  104. * Returns the rendered feed icons.
  105. *
  106. * @ingroup themeable
  107. */
  108. function theme_blockify_feed_icons($variables) {
  109. return $variables['feed_icons'];
  110. }
  111. /**
  112. * Returns the rendered menu local tasks.
  113. *
  114. * @ingroup themeable
  115. */
  116. function theme_blockify_menu_local_tasks($variables) {
  117. $tabs = theme('menu_local_tasks', $variables);
  118. if (!empty($tabs)) {
  119. return '<div id="tabs" class="clearfix">' . $tabs . '</div>';
  120. }
  121. }