styleguide.theme.inc 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. // $Id: styleguide.theme.inc,v 1.1 2010/10/23 20:58:17 agentken Exp $
  3. /**
  4. * @file
  5. * Theme file for Style Guide module.
  6. */
  7. /**
  8. * Theme the page header.
  9. *
  10. * @param $variables
  11. * The theme variables array, including:
  12. * -- 'theme_info' an array of information about the current theme.
  13. */
  14. function theme_styleguide_header($variables) {
  15. $theme_info = $variables['theme_info'];
  16. $output = '<h2>' . t('Showing style guide for %theme', array('%theme' => $theme_info['name'])) . '</h2>';
  17. if (isset($theme_info['description'])) {
  18. $output .= '<p>' . $theme_info['description'] . '</p>';
  19. }
  20. $output .= '<h2 class="styleguide">'. t('Styleguide element entries') .'</h2>';
  21. $output .= '<p class="styleguide-description">' . t('Optional item description.') . '</p>';
  22. $output .= '<div class="styleguide">';
  23. $output .= t('The header area indicates the style element being displayed. The horizontal rules indicate the top and bottom baselines of the rendered element.');
  24. $output .= '</div>';
  25. $output .= '<div class="break"><br /></div>';
  26. return $output;
  27. }
  28. /**
  29. * Theme a display item.
  30. *
  31. * @param $variables
  32. * The theme variables array, including:
  33. * -- 'key' a unique string indicating the name of the item.
  34. * -- 'item' an array of data about the item.
  35. * -- 'content' the content to display for this item.
  36. *
  37. * @see hook_styleguide()
  38. */
  39. function theme_styleguide_item($variables) {
  40. $key = $variables['key'];
  41. $item = $variables['item'];
  42. $content = $variables['content'];
  43. $output = '';
  44. $output .= "<a name=\"$key\"></a>";
  45. $output .= '<h2 class="styleguide">'. $item['title'] .'</h2>';
  46. if (!empty($item['description'])) {
  47. $output .= '<p class="styleguide-description">';
  48. $output .= $item['description'];
  49. $output .= '</p>';
  50. }
  51. $output .= '<div class="styleguide">';
  52. $output .= $content;
  53. $output .= '</div>';
  54. return $output;
  55. }
  56. /**
  57. * Theme the page links.
  58. *
  59. * NOTE: these may be turned into sub-tabs.
  60. *
  61. * @param $variables
  62. * The theme variables array, including:
  63. * -- 'items' the list of links.
  64. */
  65. function theme_styleguide_links($variables) {
  66. // Close the header.
  67. $output = '<div id="styleguide-header">';
  68. $output .= $variables['items'];
  69. $output .= '<div class="break"><br /></div>';
  70. $output .= '</div>';
  71. return $output;
  72. }
  73. /**
  74. * Theme the content.
  75. *
  76. * This function is here in case anyone wants to change it.
  77. *
  78. * @param $variables
  79. * The theme variables array, including:
  80. * -- 'content' an HTML content element.
  81. */
  82. function theme_styleguide_content($variables) {
  83. return $variables['content'];
  84. }