template.php

  1. cis7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  2. cis7 sites/all/themes/ulmus/rubik/template.php
  3. cis7 sites/all/themes/local_contrib/zurb-foundation/template.php
  4. cis7 sites/all/themes/ulmus/skeletontheme/template.php
  5. cis7 sites/all/themes/ulmus/corolla/template.php
  6. cis7 sites/all/themes/ulmus/ember/template.php
  7. cis7 sites/all/themes/ulmus/respond/template.php
  8. cis7 sites/all/themes/ulmus/aurora/template.php
  9. cis7 sites/all/themes/ulmus/tao/template.php
  10. cis7 sites/all/themes/ulmus/fontfolio/template.php
  11. cis7 modules/simpletest/tests/themes/test_theme/template.php
  12. cis7 profiles/cis/themes/cis-theme/template.php
  13. cis7 sites/all/themes/local_contrib/zurb-foundation/STARTER/template.php
  14. cis7 sites/all/themes/ulmus/omega/alpha/template.php
  15. cis7 sites/all/themes/ulmus/omega/omega/template.php
  16. cis7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  17. cis7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  18. cis7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  19. cis7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  20. cis7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  21. cis7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  22. cis7 sites/all/themes/elmsln_contrib/chamfer/template.php
  23. cis7 themes/garland/template.php
  24. cis7 themes/bartik/template.php
  25. cis7 themes/seven/template.php
  26. cis7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  27. cle7 sites/all/themes/ulmus/omega/omega/template.php
  28. cle7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  29. cle7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  30. cle7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  31. cle7 sites/all/themes/ulmus/skeletontheme/template.php
  32. cle7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  33. cle7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  34. cle7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  35. cle7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  36. cle7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  37. cle7 sites/all/themes/local_contrib/bootstrap/bootstrap_subtheme/template.php
  38. cle7 sites/all/themes/ulmus/omega/alpha/template.php
  39. cle7 sites/all/themes/elmsln_contrib/chamfer/template.php
  40. cle7 modules/simpletest/tests/themes/test_theme/template.php
  41. cle7 sites/all/themes/ulmus/rubik/template.php
  42. cle7 sites/all/themes/ulmus/fontfolio/template.php
  43. cle7 sites/all/themes/ulmus/tao/template.php
  44. cle7 sites/all/themes/ulmus/aurora/template.php
  45. cle7 sites/all/themes/ulmus/respond/template.php
  46. cle7 sites/all/themes/ulmus/ember/template.php
  47. cle7 sites/all/themes/ulmus/corolla/template.php
  48. cle7 sites/all/themes/local_contrib/bootstrap/template.php
  49. cle7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  50. cle7 themes/garland/template.php
  51. cle7 themes/bartik/template.php
  52. cle7 sites/all/themes/local_contrib/zurb_foundation/template.php
  53. cle7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  54. cle7 themes/seven/template.php
  55. ecd7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  56. ecd7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  57. ecd7 sites/all/themes/ulmus/omega/omega/template.php
  58. ecd7 sites/all/themes/ulmus/omega/alpha/template.php
  59. ecd7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  60. ecd7 modules/simpletest/tests/themes/test_theme/template.php
  61. ecd7 sites/all/themes/ulmus/rubik/template.php
  62. ecd7 sites/all/themes/ulmus/fontfolio/template.php
  63. ecd7 sites/all/themes/ulmus/tao/template.php
  64. ecd7 sites/all/themes/ulmus/aurora/template.php
  65. ecd7 sites/all/themes/ulmus/respond/template.php
  66. ecd7 sites/all/themes/ulmus/ember/template.php
  67. ecd7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  68. ecd7 themes/garland/template.php
  69. ecd7 themes/bartik/template.php
  70. ecd7 themes/seven/template.php
  71. ecd7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  72. ecd7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  73. ecd7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  74. ecd7 sites/all/themes/elmsln_contrib/chamfer/template.php
  75. ecd7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  76. ecd7 sites/all/themes/local_contrib/zurb_foundation/template.php
  77. ecd7 sites/all/themes/ulmus/skeletontheme/template.php
  78. ecd7 sites/all/themes/ulmus/corolla/template.php
  79. ecd7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  80. elmsmedia7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  81. elmsmedia7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  82. elmsmedia7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  83. elmsmedia7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  84. elmsmedia7 sites/all/themes/local_contrib/zurb_foundation/template.php
  85. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  86. elmsmedia7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  87. elmsmedia7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  88. elmsmedia7 sites/all/themes/ulmus/respond/template.php
  89. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  90. elmsmedia7 themes/seven/template.php
  91. elmsmedia7 themes/garland/template.php
  92. elmsmedia7 sites/all/themes/elmsln_contrib/chamfer/template.php
  93. elmsmedia7 sites/all/themes/ulmus/rubik/template.php
  94. elmsmedia7 sites/all/themes/ulmus/skeletontheme/template.php
  95. elmsmedia7 sites/all/themes/ulmus/fontfolio/template.php
  96. elmsmedia7 sites/all/themes/ulmus/tao/template.php
  97. elmsmedia7 sites/all/themes/ulmus/aurora/template.php
  98. elmsmedia7 sites/all/themes/ulmus/ember/template.php
  99. elmsmedia7 sites/all/themes/ulmus/corolla/template.php
  100. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  101. elmsmedia7 modules/simpletest/tests/themes/test_theme/template.php
  102. elmsmedia7 sites/all/themes/ulmus/omega/alpha/template.php
  103. elmsmedia7 sites/all/themes/ulmus/omega/omega/template.php
  104. elmsmedia7 themes/bartik/template.php
  105. harmony7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  106. harmony7 sites/all/themes/local_contrib/zurb_foundation/template.php
  107. harmony7 sites/all/themes/elmsln_contrib/chamfer/template.php
  108. harmony7 sites/all/themes/local_contrib/bootstrap/template.php
  109. harmony7 sites/all/themes/local_contrib/bootstrap/bootstrap_subtheme/template.php
  110. harmony7 modules/simpletest/tests/themes/test_theme/template.php
  111. harmony7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  112. harmony7 sites/all/themes/ulmus/corolla/template.php
  113. harmony7 sites/all/themes/ulmus/omega/alpha/template.php
  114. harmony7 sites/all/themes/ulmus/omega/omega/template.php
  115. harmony7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  116. harmony7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  117. harmony7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  118. harmony7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  119. harmony7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  120. harmony7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  121. harmony7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  122. harmony7 themes/seven/template.php
  123. harmony7 themes/bartik/template.php
  124. harmony7 themes/garland/template.php
  125. harmony7 sites/all/themes/ulmus/skeletontheme/template.php
  126. harmony7 sites/all/themes/ulmus/tao/template.php
  127. harmony7 sites/all/themes/ulmus/ember/template.php
  128. harmony7 sites/all/themes/ulmus/aurora/template.php
  129. harmony7 sites/all/themes/ulmus/fontfolio/template.php
  130. harmony7 sites/all/themes/ulmus/rubik/template.php
  131. harmony7 sites/all/themes/ulmus/respond/template.php
  132. icor7 sites/all/themes/ulmus/respond/template.php
  133. icor7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  134. icor7 sites/all/themes/local_contrib/zurb_foundation/template.php
  135. icor7 themes/seven/template.php
  136. icor7 themes/bartik/template.php
  137. icor7 themes/garland/template.php
  138. icor7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  139. icor7 sites/all/themes/elmsln_contrib/chamfer/template.php
  140. icor7 sites/all/themes/ulmus/skeletontheme/template.php
  141. icor7 sites/all/themes/ulmus/corolla/template.php
  142. icor7 sites/all/themes/ulmus/ember/template.php
  143. icor7 sites/all/themes/ulmus/fontfolio/template.php
  144. icor7 sites/all/themes/ulmus/aurora/template.php
  145. icor7 sites/all/themes/ulmus/tao/template.php
  146. icor7 modules/simpletest/tests/themes/test_theme/template.php
  147. icor7 sites/all/themes/ulmus/omega/alpha/template.php
  148. icor7 sites/all/themes/ulmus/omega/omega/template.php
  149. icor7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  150. icor7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  151. icor7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  152. icor7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  153. icor7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  154. icor7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  155. icor7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  156. icor7 sites/all/themes/ulmus/rubik/template.php
  157. meedjum_blog7 themes/seven/template.php
  158. meedjum_blog7 themes/bartik/template.php
  159. meedjum_blog7 sites/all/themes/ulmus/fontfolio/template.php
  160. meedjum_blog7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  161. meedjum_blog7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  162. meedjum_blog7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  163. meedjum_blog7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  164. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  165. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  166. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  167. meedjum_blog7 sites/all/themes/ulmus/omega/omega/template.php
  168. meedjum_blog7 sites/all/themes/ulmus/omega/alpha/template.php
  169. meedjum_blog7 modules/simpletest/tests/themes/test_theme/template.php
  170. meedjum_blog7 sites/all/themes/ulmus/rubik/template.php
  171. meedjum_blog7 sites/all/themes/ulmus/tao/template.php
  172. meedjum_blog7 sites/all/themes/ulmus/aurora/template.php
  173. meedjum_blog7 sites/all/themes/ulmus/respond/template.php
  174. meedjum_blog7 sites/all/themes/ulmus/ember/template.php
  175. meedjum_blog7 sites/all/themes/ulmus/corolla/template.php
  176. meedjum_blog7 sites/all/themes/ulmus/skeletontheme/template.php
  177. meedjum_blog7 sites/all/themes/elmsln_contrib/chamfer/template.php
  178. meedjum_blog7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  179. meedjum_blog7 sites/all/themes/local_contrib/zurb_foundation/template.php
  180. meedjum_blog7 sites/all/themes/local_contrib/meedjum/template.php
  181. meedjum_blog7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  182. meedjum_blog7 themes/garland/template.php
  183. mooc7 themes/seven/template.php
  184. mooc7 sites/all/themes/local_contrib/zurb_foundation/STARTER/template.php
  185. mooc7 sites/all/themes/elmsln_contrib/chamfer/template.php
  186. mooc7 themes/bartik/template.php
  187. mooc7 sites/all/themes/ulmus/omega/alpha/template.php
  188. mooc7 sites/all/themes/elmsln_contrib/foundation_access/template.php
  189. mooc7 sites/all/modules/ulmus/libraries/tests/themes/libraries_test_theme/template.php
  190. mooc7 sites/all/themes/ulmus/omega/starterkits/omega-xhtml/template.php
  191. mooc7 sites/all/themes/ulmus/omega/starterkits/omega-html5/template.php
  192. mooc7 sites/all/themes/ulmus/omega/starterkits/alpha-xhtml/template.php
  193. mooc7 sites/all/themes/ulmus/adaptivetheme/at_admin/template.php
  194. mooc7 sites/all/themes/ulmus/adaptivetheme/at_core/template.php
  195. mooc7 sites/all/themes/ulmus/adaptivetheme/at_subtheme/template.php
  196. mooc7 sites/all/themes/ulmus/omega/omega/template.php
  197. mooc7 modules/simpletest/tests/themes/test_theme/template.php
  198. mooc7 themes/garland/template.php
  199. mooc7 sites/all/themes/ulmus/rubik/template.php
  200. mooc7 sites/all/themes/ulmus/fontfolio/template.php
  201. mooc7 sites/all/themes/ulmus/tao/template.php
  202. mooc7 sites/all/themes/ulmus/aurora/template.php
  203. mooc7 sites/all/themes/ulmus/respond/template.php
  204. mooc7 sites/all/themes/ulmus/ember/template.php
  205. mooc7 sites/all/themes/ulmus/corolla/template.php
  206. mooc7 sites/all/themes/ulmus/skeletontheme/template.php
  207. mooc7 sites/all/themes/local_contrib/zurb_foundation/template.php
  208. mooc7 sites/all/modules/local_contrib/omega_tools/default/template.php

Functions

Namesort descending Description
tao_css_alter Implements hook_css_alter(). @TODO: Once http://drupal.org/node/901062 is resolved, determine whether this can be implemented in the .info file instead.
tao_pager Override of theme_pager(). Easily one of the most obnoxious theming jobs in Drupal core. Goals: consolidate functionality into less than 5 functions and ensure the markup will not conflict with major other styles (theme_item_list() in particular).
tao_pager_link Return an array suitable for theme_links() rather than marked up HTML link.
tao_pager_list Split out page list generation into its own function.
tao_preprocess_block Implementation of preprocess_block().
tao_preprocess_comment Implementation of preprocess_comment().
tao_preprocess_field Implementation of preprocess_field().
tao_preprocess_fieldset Implementation of preprocess_fieldset().
tao_preprocess_html Preprocess functions ===============================================
tao_preprocess_node Implementation of preprocess_node().
tao_preprocess_page Implementation of preprocess_page().
tao_textarea Override of theme('textarea'). Deprecate misc/textarea.js in favor of using the 'resize' CSS3 property.
tao_theme Implementation of hook_theme().
tao_views_mini_pager Override of theme_views_mini_pager().

File

sites/all/themes/ulmus/tao/template.php
View source
  1. <?php
  2. /**
  3. * Implements hook_css_alter().
  4. * @TODO: Once http://drupal.org/node/901062 is resolved, determine whether
  5. * this can be implemented in the .info file instead.
  6. *
  7. * Omitted:
  8. * - color.css
  9. * - contextual.css
  10. * - dashboard.css
  11. * - field_ui.css
  12. * - image.css
  13. * - locale.css
  14. * - shortcut.css
  15. * - simpletest.css
  16. * - toolbar.css
  17. */
  18. function tao_css_alter(&$css) {
  19. $exclude = array(
  20. 'misc/vertical-tabs.css' => FALSE,
  21. 'modules/aggregator/aggregator.css' => FALSE,
  22. 'modules/block/block.css' => FALSE,
  23. 'modules/book/book.css' => FALSE,
  24. 'modules/comment/comment.css' => FALSE,
  25. 'modules/dblog/dblog.css' => FALSE,
  26. 'modules/file/file.css' => FALSE,
  27. 'modules/filter/filter.css' => FALSE,
  28. 'modules/forum/forum.css' => FALSE,
  29. 'modules/help/help.css' => FALSE,
  30. 'modules/menu/menu.css' => FALSE,
  31. 'modules/node/node.css' => FALSE,
  32. 'modules/openid/openid.css' => FALSE,
  33. 'modules/poll/poll.css' => FALSE,
  34. 'modules/profile/profile.css' => FALSE,
  35. 'modules/search/search.css' => FALSE,
  36. 'modules/statistics/statistics.css' => FALSE,
  37. 'modules/syslog/syslog.css' => FALSE,
  38. 'modules/system/admin.css' => FALSE,
  39. 'modules/system/maintenance.css' => FALSE,
  40. 'modules/system/system.css' => FALSE,
  41. 'modules/system/system.admin.css' => FALSE,
  42. 'modules/system/system.base.css' => FALSE,
  43. 'modules/system/system.maintenance.css' => FALSE,
  44. 'modules/system/system.menus.css' => FALSE,
  45. 'modules/system/system.messages.css' => FALSE,
  46. 'modules/system/system.theme.css' => FALSE,
  47. 'modules/taxonomy/taxonomy.css' => FALSE,
  48. 'modules/tracker/tracker.css' => FALSE,
  49. 'modules/update/update.css' => FALSE,
  50. 'modules/user/user.css' => FALSE,
  51. );
  52. $css = array_diff_key($css, $exclude);
  53. }
  54. /**
  55. * Implementation of hook_theme().
  56. */
  57. function tao_theme() {
  58. $items = array();
  59. // Consolidate a variety of theme functions under a single template type.
  60. $items['block'] = array(
  61. 'arguments' => array('block' => NULL),
  62. 'template' => 'object',
  63. 'path' => drupal_get_path('theme', 'tao') .'/templates',
  64. );
  65. $items['comment'] = array(
  66. 'arguments' => array('comment' => NULL, 'node' => NULL, 'links' => array()),
  67. 'template' => 'object',
  68. 'path' => drupal_get_path('theme', 'tao') .'/templates',
  69. );
  70. $items['node'] = array(
  71. 'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE),
  72. 'template' => 'node',
  73. 'path' => drupal_get_path('theme', 'tao') .'/templates',
  74. );
  75. $items['fieldset'] = array(
  76. 'arguments' => array('element' => array()),
  77. 'template' => 'fieldset',
  78. 'path' => drupal_get_path('theme', 'tao') .'/templates',
  79. );
  80. // Split out pager list into separate theme function.
  81. $items['pager_list'] = array('arguments' => array(
  82. 'tags' => array(),
  83. 'limit' => 10,
  84. 'element' => 0,
  85. 'parameters' => array(),
  86. 'quantity' => 9,
  87. ));
  88. return $items;
  89. }
  90. /**
  91. * Preprocess functions ===============================================
  92. */
  93. function tao_preprocess_html(&$vars) {
  94. $vars['classes_array'][] = 'tao';
  95. }
  96. /**
  97. * Implementation of preprocess_page().
  98. */
  99. function tao_preprocess_page(&$vars) {
  100. // Split primary and secondary local tasks
  101. $vars['primary_local_tasks'] = menu_primary_local_tasks();
  102. $vars['secondary_local_tasks'] = menu_secondary_local_tasks();
  103. // Link site name to frontpage
  104. $vars['site_name'] = l($vars['site_name'], '<front>');
  105. }
  106. /**
  107. * Implementation of preprocess_block().
  108. */
  109. function tao_preprocess_block(&$vars) {
  110. $vars['hook'] = 'block';
  111. $vars['attributes_array']['id'] = $vars['block_html_id'];
  112. $vars['title_attributes_array']['class'][] = 'block-title';
  113. $vars['title_attributes_array']['class'][] = 'clearfix';
  114. $vars['content_attributes_array']['class'][] = 'block-content';
  115. $vars['content_attributes_array']['class'][] = 'clearfix';
  116. if ($vars['block']->module == 'block') {
  117. $vars['content_attributes_array']['class'][] = 'prose';
  118. }
  119. $vars['title'] = !empty($vars['block']->subject) ? $vars['block']->subject : '';
  120. // In D7 the page content may be served as a block. Replace the generic
  121. // 'block' class from the page content with a more specific class that can
  122. // be used to distinguish this block from others.
  123. // Subthemes can easily override this behavior in an implementation of
  124. // preprocess_block().
  125. if ($vars['block']->module === 'system' && $vars['block']->delta === 'main') {
  126. $vars['classes_array'] = array_diff($vars['classes_array'], array('block'));
  127. $vars['classes_array'][] = 'block-page-content';
  128. }
  129. }
  130. /**
  131. * Implementation of preprocess_node().
  132. */
  133. function tao_preprocess_node(&$vars) {
  134. $vars['hook'] = 'node';
  135. $vars['attributes_array']['id'] = "node-{$vars['node']->nid}";
  136. $vars['title_attributes_array']['class'][] = 'node-title';
  137. $vars['title_attributes_array']['class'][] = 'clearfix';
  138. $vars['content_attributes_array']['class'][] = 'node-content';
  139. $vars['content_attributes_array']['class'][] = 'clearfix';
  140. $vars['content_attributes_array']['class'][] = 'prose';
  141. if (isset($vars['content']['links'])) {
  142. $vars['links'] = $vars['content']['links'];
  143. unset($vars['content']['links']);
  144. }
  145. if (isset($vars['content']['comments'])) {
  146. $vars['post_object']['comments'] = $vars['content']['comments'];
  147. unset($vars['content']['comments']);
  148. }
  149. if ($vars['display_submitted']) {
  150. $vars['submitted'] = t('Submitted by !username on !datetime', array(
  151. '!username' => $vars['name'],
  152. '!datetime' => $vars['date'],
  153. ));
  154. }
  155. }
  156. /**
  157. * Implementation of preprocess_comment().
  158. */
  159. function tao_preprocess_comment(&$vars) {
  160. $vars['hook'] = 'comment';
  161. $vars['title_attributes_array']['class'][] = 'comment-title';
  162. $vars['title_attributes_array']['class'][] = 'clearfix';
  163. $vars['content_attributes_array']['class'][] = 'comment-content';
  164. $vars['content_attributes_array']['class'][] = 'clearfix';
  165. $vars['submitted'] = t('Submitted by !username on !datetime', array(
  166. '!username' => $vars['author'],
  167. '!datetime' => $vars['created'],
  168. ));
  169. if (isset($vars['content']['links'])) {
  170. $vars['links'] = $vars['content']['links'];
  171. unset($vars['content']['links']);
  172. }
  173. }
  174. /**
  175. * Implementation of preprocess_fieldset().
  176. */
  177. function tao_preprocess_fieldset(&$vars) {
  178. $element = $vars['element'];
  179. _form_set_class($element, array('form-wrapper'));
  180. $vars['attributes'] = isset($element['#attributes']) ? $element['#attributes'] : array();
  181. $vars['attributes']['class'][] = 'fieldset';
  182. if (!empty($element['#title'])) {
  183. $vars['attributes']['class'][] = 'titled';
  184. }
  185. if (!empty($element['#id'])) {
  186. $vars['attributes']['id'] = $element['#id'];
  187. }
  188. $description = !empty($element['#description']) ? "<div class='description'>{$element['#description']}</div>" : '';
  189. $children = !empty($element['#children']) ? $element['#children'] : '';
  190. $value = !empty($element['#value']) ? $element['#value'] : '';
  191. $vars['content'] = $description . $children . $value;
  192. $vars['title'] = !empty($element['#title']) ? $element['#title'] : '';
  193. $vars['hook'] = 'fieldset';
  194. }
  195. /**
  196. * Implementation of preprocess_field().
  197. */
  198. function tao_preprocess_field(&$vars) {
  199. // Add prose class to long text fields.
  200. if ($vars['element']['#field_type'] === 'text_with_summary') {
  201. $vars['classes_array'][] = 'prose';
  202. }
  203. }
  204. /**
  205. * Function overrides =================================================
  206. */
  207. /**
  208. * Override of theme('textarea').
  209. * Deprecate misc/textarea.js in favor of using the 'resize' CSS3 property.
  210. */
  211. function tao_textarea($variables) {
  212. $element = $variables['element'];
  213. $element['#attributes']['name'] = $element['#name'];
  214. $element['#attributes']['id'] = $element['#id'];
  215. $element['#attributes']['cols'] = $element['#cols'];
  216. $element['#attributes']['rows'] = $element['#rows'];
  217. _form_set_class($element, array('form-textarea'));
  218. $wrapper_attributes = array(
  219. 'class' => array('form-textarea-wrapper'),
  220. );
  221. // Add resizable behavior.
  222. if (!empty($element['#resizable'])) {
  223. $wrapper_attributes['class'][] = 'resizable';
  224. }
  225. $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
  226. $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
  227. $output .= '</div>';
  228. return $output;
  229. }
  230. /**
  231. * Override of theme_pager().
  232. * Easily one of the most obnoxious theming jobs in Drupal core.
  233. * Goals: consolidate functionality into less than 5 functions and
  234. * ensure the markup will not conflict with major other styles
  235. * (theme_item_list() in particular).
  236. */
  237. function tao_pager($vars) {
  238. $tags = $vars['tags'];
  239. $element = $vars['element'];
  240. $parameters = $vars['parameters'];
  241. $quantity = $vars['quantity'];
  242. $pager_list = theme('pager_list', $vars);
  243. $links = array();
  244. $links['pager-first'] = theme('pager_first', array(
  245. 'text' => (isset($tags[0]) ? $tags[0] : t('First')),
  246. 'element' => $element,
  247. 'parameters' => $parameters
  248. ));
  249. $links['pager-previous'] = theme('pager_previous', array(
  250. 'text' => (isset($tags[1]) ? $tags[1] : t('Prev')),
  251. 'element' => $element,
  252. 'interval' => 1,
  253. 'parameters' => $parameters
  254. ));
  255. $links['pager-next'] = theme('pager_next', array(
  256. 'text' => (isset($tags[3]) ? $tags[3] : t('Next')),
  257. 'element' => $element,
  258. 'interval' => 1,
  259. 'parameters' => $parameters
  260. ));
  261. $links['pager-last'] = theme('pager_last', array(
  262. 'text' => (isset($tags[4]) ? $tags[4] : t('Last')),
  263. 'element' => $element,
  264. 'parameters' => $parameters
  265. ));
  266. $links = array_filter($links);
  267. $pager_links = theme('links', array(
  268. 'links' => $links,
  269. 'attributes' => array('class' => 'links pager pager-links')
  270. ));
  271. if ($pager_list) {
  272. return "<div class='pager clearfix'>$pager_list $pager_links</div>";
  273. }
  274. }
  275. /**
  276. * Split out page list generation into its own function.
  277. */
  278. function tao_pager_list($vars) {
  279. $tags = $vars['tags'];
  280. $element = $vars['element'];
  281. $parameters = $vars['parameters'];
  282. $quantity = $vars['quantity'];
  283. global $pager_page_array, $pager_total;
  284. if ($pager_total[$element] > 1) {
  285. // Calculate various markers within this pager piece:
  286. // Middle is used to "center" pages around the current page.
  287. $pager_middle = ceil($quantity / 2);
  288. // current is the page we are currently paged to
  289. $pager_current = $pager_page_array[$element] + 1;
  290. // first is the first page listed by this pager piece (re quantity)
  291. $pager_first = $pager_current - $pager_middle + 1;
  292. // last is the last page listed by this pager piece (re quantity)
  293. $pager_last = $pager_current + $quantity - $pager_middle;
  294. // max is the maximum page number
  295. $pager_max = $pager_total[$element];
  296. // End of marker calculations.
  297. // Prepare for generation loop.
  298. $i = $pager_first;
  299. if ($pager_last > $pager_max) {
  300. // Adjust "center" if at end of query.
  301. $i = $i + ($pager_max - $pager_last);
  302. $pager_last = $pager_max;
  303. }
  304. if ($i <= 0) {
  305. // Adjust "center" if at start of query.
  306. $pager_last = $pager_last + (1 - $i);
  307. $i = 1;
  308. }
  309. // End of generation loop preparation.
  310. $links = array();
  311. // When there is more than one page, create the pager list.
  312. if ($i != $pager_max) {
  313. // Now generate the actual pager piece.
  314. for ($i; $i <= $pager_last && $i <= $pager_max; $i++) {
  315. if ($i < $pager_current) {
  316. $links["$i pager-item"] = theme('pager_previous', array(
  317. 'text' => $i,
  318. 'element' => $element,
  319. 'interval' => ($pager_current - $i),
  320. 'parameters' => $parameters
  321. ));
  322. }
  323. if ($i == $pager_current) {
  324. $links["$i pager-current"] = array('title' => $i);
  325. }
  326. if ($i > $pager_current) {
  327. $links["$i pager-item"] = theme('pager_next', array(
  328. 'text' => $i,
  329. 'element' => $element,
  330. 'interval' => ($i - $pager_current),
  331. 'parameters' => $parameters
  332. ));
  333. }
  334. }
  335. return theme('links', array(
  336. 'links' => $links,
  337. 'attributes' => array('class' => 'links pager pager-list')
  338. ));
  339. }
  340. }
  341. return '';
  342. }
  343. /**
  344. * Return an array suitable for theme_links() rather than marked up HTML link.
  345. */
  346. function tao_pager_link($vars) {
  347. $text = $vars['text'];
  348. $page_new = $vars['page_new'];
  349. $element = $vars['element'];
  350. $parameters = $vars['parameters'];
  351. $attributes = $vars['attributes'];
  352. $page = isset($_GET['page']) ? $_GET['page'] : '';
  353. if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
  354. $parameters['page'] = $new_page;
  355. }
  356. $query = array();
  357. if (count($parameters)) {
  358. $query = drupal_get_query_parameters($parameters, array());
  359. }
  360. if ($query_pager = pager_get_query_parameters()) {
  361. $query = array_merge($query, $query_pager);
  362. }
  363. // Set each pager link title
  364. if (!isset($attributes['title'])) {
  365. static $titles = NULL;
  366. if (!isset($titles)) {
  367. $titles = array(
  368. t('« first') => t('Go to first page'),
  369. t('‹ previous') => t('Go to previous page'),
  370. t('next ›') => t('Go to next page'),
  371. t('last »') => t('Go to last page'),
  372. );
  373. }
  374. if (isset($titles[$text])) {
  375. $attributes['title'] = $titles[$text];
  376. }
  377. else if (is_numeric($text)) {
  378. $attributes['title'] = t('Go to page @number', array('@number' => $text));
  379. }
  380. }
  381. return array(
  382. 'title' => $text,
  383. 'href' => $_GET['q'],
  384. 'attributes' => $attributes,
  385. 'query' => count($query) ? $query : NULL,
  386. );
  387. }
  388. /**
  389. * Override of theme_views_mini_pager().
  390. */
  391. function tao_views_mini_pager($vars) {
  392. $tags = $vars['tags'];
  393. $quantity = $vars['quantity'];
  394. $element = $vars['element'];
  395. $parameters = $vars['parameters'];
  396. global $pager_page_array, $pager_total;
  397. // Calculate various markers within this pager piece:
  398. // Middle is used to "center" pages around the current page.
  399. $pager_middle = ceil($quantity / 2);
  400. // current is the page we are currently paged to
  401. $pager_current = $pager_page_array[$element] + 1;
  402. // max is the maximum page number
  403. $pager_max = $pager_total[$element];
  404. // End of marker calculations.
  405. $links = array();
  406. if ($pager_total[$element] > 1) {
  407. $links['pager-previous'] = theme('pager_previous', array(
  408. 'text' => (isset($tags[1]) ? $tags[1] : t('Prev')),
  409. 'element' => $element,
  410. 'interval' => 1,
  411. 'parameters' => $parameters
  412. ));
  413. $links['pager-current'] = array(
  414. 'title' => t('@current of @max', array(
  415. '@current' => $pager_current,
  416. '@max' => $pager_max)
  417. )
  418. );
  419. $links['pager-next'] = theme('pager_next', array(
  420. 'text' => (isset($tags[3]) ? $tags[3] : t('Next')),
  421. 'element' => $element,
  422. 'interval' => 1,
  423. 'parameters' => $parameters
  424. ));
  425. return theme('links', array('links' => $links, 'attributes' => array('class' => array('links', 'pager', 'views-mini-pager'))));
  426. }
  427. }