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
rubik_admin_block_content Override of theme_admin_block_content().
rubik_admin_drilldown_menu_item_link Override of theme('admin_drilldown_menu_item_link').
rubik_breadcrumb Override of theme('breadcrumb').
rubik_css_alter Implements hook_css_alter(). @TODO: Do this in .info once http://drupal.org/node/575298 is committed.
rubik_filter_guidelines Override of theme('filter_guidelines').
rubik_form_field_ui_field_edit_form_alter
rubik_form_node_form_alter
rubik_menu_local_task Override of theme('menu_local_task').
rubik_node_add_list Override of theme('node_add_list').
rubik_preprocess_admin_block Preprocessor for theme('admin_block').
rubik_preprocess_button Preprocessor for theme('button').
rubik_preprocess_comment Preprocessor for theme('comment').
rubik_preprocess_comment_wrapper Preprocessor for theme('comment_wrapper').
rubik_preprocess_fieldset Preprocessor for theme('fieldset').
rubik_preprocess_form_buttons Preprocessor for handling form button for most forms.
rubik_preprocess_form_confirm Preprocessor for theme('confirm_form').
rubik_preprocess_form_node Preprocessor for theme('node_form').
rubik_preprocess_help Preprocessor for theme('help').
rubik_preprocess_help_page Preprocessor for theme('help_page').
rubik_preprocess_html
rubik_preprocess_node Preprocessor for theme('node').
rubik_preprocess_page Preprocessor for theme('page').
rubik_preprocess_textfield Preprocessor for theme('textfield').
rubik_render_clone Helper function for cloning and drupal_render()'ing elements.
rubik_theme Implementation of hook_theme().
_rubik_icon_classes Generate an icon class from a path.
_rubik_local_tasks
_rubik_submitted Helper function to submitted info theming functions.

File

sites/all/themes/ulmus/rubik/template.php
View source
  1. <?php
  2. /*
  3. * Implements hook_preprocess_html().
  4. */
  5. function rubik_preprocess_html(&$vars) {
  6. if (theme_get_setting('rubik_inline_field_descriptions')) {
  7. $vars['classes_array'][] = 'rubik-inline-field-descriptions';
  8. }
  9. }
  10. /**
  11. * Implements hook_css_alter().
  12. * @TODO: Do this in .info once http://drupal.org/node/575298 is committed.
  13. */
  14. function rubik_css_alter(&$css) {
  15. if (isset($css['modules/overlay/overlay-child.css'])) {
  16. $css['modules/overlay/overlay-child.css']['data'] = drupal_get_path('theme', 'rubik') . '/overlay-child.css';
  17. }
  18. if (isset($css['modules/shortcut/shortcut.css'])) {
  19. $css['modules/shortcut/shortcut.css']['data'] = drupal_get_path('theme', 'rubik') . '/shortcut.css';
  20. }
  21. }
  22. /**
  23. * Implementation of hook_theme().
  24. */
  25. function rubik_theme() {
  26. $items = array();
  27. // Content theming.
  28. $items['help'] =
  29. $items['node'] =
  30. $items['comment'] =
  31. $items['comment_wrapper'] = array(
  32. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  33. 'template' => 'object',
  34. );
  35. $items['node']['template'] = 'node';
  36. // Help pages really need help. See preprocess_page().
  37. $items['help_page'] = array(
  38. 'variables' => array('content' => array()),
  39. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  40. 'template' => 'object',
  41. 'preprocess functions' => array(
  42. 'template_preprocess',
  43. 'rubik_preprocess_help_page',
  44. ),
  45. 'process functions' => array('template_process'),
  46. );
  47. if (!theme_get_setting('rubik_disable_sidebar_in_form')) {
  48. // Form layout: default (2 column).
  49. $items['block_add_block_form'] =
  50. $items['block_admin_configure'] =
  51. $items['comment_form'] =
  52. $items['contact_admin_edit'] =
  53. $items['contact_mail_page'] =
  54. $items['contact_mail_user'] =
  55. $items['filter_admin_format_form'] =
  56. $items['forum_form'] =
  57. $items['locale_languages_edit_form'] =
  58. $items['menu_edit_menu'] =
  59. $items['menu_edit_item'] =
  60. $items['node_type_form'] =
  61. $items['path_admin_form'] =
  62. $items['system_settings_form'] =
  63. $items['system_themes_form'] =
  64. $items['system_modules'] =
  65. $items['system_actions_configure'] =
  66. $items['taxonomy_form_term'] =
  67. $items['taxonomy_form_vocabulary'] =
  68. $items['user_profile_form'] =
  69. $items['user_admin_access_add_form'] = array(
  70. 'render element' => 'form',
  71. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  72. 'template' => 'form-default',
  73. 'preprocess functions' => array(
  74. 'rubik_preprocess_form_buttons',
  75. ),
  76. );
  77. // These forms require additional massaging.
  78. $items['confirm_form'] = array(
  79. 'render element' => 'form',
  80. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  81. 'template' => 'form-simple',
  82. 'preprocess functions' => array(
  83. 'rubik_preprocess_form_confirm'
  84. ),
  85. );
  86. $items['node_form'] = array(
  87. 'render element' => 'form',
  88. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  89. 'template' => 'form-default',
  90. 'preprocess functions' => array(
  91. 'rubik_preprocess_form_buttons',
  92. 'rubik_preprocess_form_node',
  93. ),
  94. );
  95. }
  96. return $items;
  97. }
  98. /**
  99. * Preprocessor for theme('page').
  100. */
  101. function rubik_preprocess_page(&$vars) {
  102. // Show a warning if base theme is not present.
  103. if (!function_exists('tao_theme') && user_access('administer site configuration')) {
  104. drupal_set_message(t('The Rubik theme requires the !tao base theme in order to work properly.', array('!tao' => l('Tao', 'http://drupal.org/project/tao'))), 'warning');
  105. }
  106. // Set a page icon class.
  107. $vars['page_icon_class'] = ($item = menu_get_item()) ? implode(' ' , _rubik_icon_classes($item['href'])) : '';
  108. // Help pages. They really do need help.
  109. if (strpos($_GET['q'], 'admin/help/') === 0 && isset($vars['page']['content']['system_main']['main']['#markup'])) {
  110. $vars['page']['content']['system_main']['main']['#markup'] = theme('help_page', array('content' => $vars['page']['content']['system_main']['main']['#markup']));
  111. }
  112. // Clear out help text if empty.
  113. if (empty($vars['help']) || !(strip_tags($vars['help']))) {
  114. $vars['help'] = '';
  115. }
  116. // Process local tasks. This will get called for rubik and its subthemes.
  117. _rubik_local_tasks($vars);
  118. // Overlay is enabled.
  119. $vars['overlay'] = (module_exists('overlay') && overlay_get_mode() === 'child');
  120. }
  121. /**
  122. * Preprocessor for theme('fieldset').
  123. */
  124. function rubik_preprocess_fieldset(&$vars) {
  125. if (!empty($vars['element']['#collapsible'])) {
  126. $vars['title'] = "<span class='icon'></span>" . $vars['title'];
  127. }
  128. }
  129. /**
  130. * Preprocessor for handling form button for most forms.
  131. */
  132. function rubik_preprocess_form_buttons(&$vars) {
  133. if (!empty($vars['form']['actions'])) {
  134. $vars['actions'] = $vars['form']['actions'];
  135. unset($vars['form']['actions']);
  136. }
  137. }
  138. /**
  139. * Preprocessor for theme('confirm_form').
  140. */
  141. function rubik_preprocess_form_confirm(&$vars) {
  142. // Move the title from the page title (usually too big and unwieldy)
  143. $title = filter_xss_admin(drupal_get_title());
  144. $vars['form']['description']['#type'] = 'item';
  145. $vars['form']['description']['#value'] = empty($vars['form']['description']['#value']) ?
  146. "<strong>{$title}</strong>" :
  147. "<strong>{$title}</strong><p>{$vars['form']['description']['#value']}</p>";
  148. drupal_set_title(t('Please confirm'));
  149. }
  150. /**
  151. * Preprocessor for theme('node_form').
  152. */
  153. function rubik_preprocess_form_node(&$vars) {
  154. $vars['sidebar'] = isset($vars['sidebar']) ? $vars['sidebar'] : array();
  155. // Support field_group if present.
  156. if (module_exists('field_group')) {
  157. $map = array(
  158. 'group_sidebar' => 'sidebar',
  159. 'group_footer' => 'footer',
  160. );
  161. }
  162. // Support nodeformcols if present.
  163. elseif (module_exists('nodeformcols')) {
  164. $map = array(
  165. 'nodeformcols_region_right' => 'sidebar',
  166. 'nodeformcols_region_footer' => 'footer',
  167. 'nodeformcols_region_main' => NULL,
  168. );
  169. }
  170. if (isset($map)) {
  171. foreach ($map as $region => $target) {
  172. if (isset($vars['form'][$region])) {
  173. if (isset($vars['form'][$region]['#prefix'], $vars['form'][$region]['#suffix'])) {
  174. unset($vars['form'][$region]['#prefix']);
  175. unset($vars['form'][$region]['#suffix']);
  176. }
  177. if (isset($vars['form'][$region]['actions'], $vars['form'][$region]['actions'])) {
  178. $vars['actions'] = $vars['form'][$region]['actions'];
  179. unset($vars['form'][$region]['actions']);
  180. }
  181. if (isset($target)) {
  182. $vars[$target] = $vars['form'][$region];
  183. unset($vars['form'][$region]);
  184. }
  185. }
  186. }
  187. }
  188. // Default to showing taxonomy in sidebar if nodeformcols is not present.
  189. elseif (isset($vars['form']['taxonomy']) && empty($vars['sidebar'])) {
  190. $vars['sidebar']['taxonomy'] = $vars['form']['taxonomy'];
  191. unset($vars['form']['taxonomy']);
  192. }
  193. }
  194. /**
  195. * Preprocessor for theme('button').
  196. */
  197. function rubik_preprocess_button(&$vars) {
  198. if (isset($vars['element']['#value'])) {
  199. $classes = array(
  200. t('Save') => 'yes',
  201. t('Submit') => 'yes',
  202. t('Yes') => 'yes',
  203. t('Add') => 'add',
  204. t('Delete') => 'remove',
  205. t('Remove') => 'remove',
  206. t('Cancel') => 'no',
  207. t('No') => 'no',
  208. );
  209. foreach ($classes as $search => $class) {
  210. if (strpos($vars['element']['#value'], $search) !== FALSE) {
  211. $vars['element']['#attributes']['class'][] = 'button-' . $class;
  212. break;
  213. }
  214. }
  215. }
  216. }
  217. /**
  218. * Preprocessor for theme('help').
  219. */
  220. function rubik_preprocess_help(&$vars) {
  221. $vars['hook'] = 'help';
  222. $vars['attr']['id'] = 'help-text';
  223. $class = 'path-admin-help clear-block toggleable';
  224. $vars['attr']['class'] = isset($vars['attr']['class']) ? "{$vars['attr']['class']} $class" : $class;
  225. $help = menu_get_active_help();
  226. if (($test = strip_tags($help)) && !empty($help)) {
  227. // Thankfully this is static cached.
  228. $vars['attr']['class'] .= menu_secondary_local_tasks() ? ' with-tabs' : '';
  229. $vars['is_prose'] = TRUE;
  230. $vars['layout'] = TRUE;
  231. $vars['content'] = "<span class='icon'></span>" . $help;
  232. // Link to help section.
  233. $item = menu_get_item('admin/help');
  234. if ($item && $item['path'] === 'admin/help' && $item['access']) {
  235. $vars['links'] = l(t('More help topics'), 'admin/help');
  236. }
  237. }
  238. }
  239. /**
  240. * Preprocessor for theme('help_page').
  241. */
  242. function rubik_preprocess_help_page(&$vars) {
  243. $vars['hook'] = 'help-page';
  244. $vars['title_attributes_array']['class'][] = 'help-page-title';
  245. $vars['title_attributes_array']['class'][] = 'clearfix';
  246. $vars['content_attributes_array']['class'][] = 'help-page-content';
  247. $vars['content_attributes_array']['class'][] = 'clearfix';
  248. $vars['content_attributes_array']['class'][] = 'prose';
  249. $vars['layout'] = TRUE;
  250. // Truly hackish way to navigate help pages.
  251. $module_info = system_rebuild_module_data();
  252. $empty_arg = drupal_help_arg();
  253. $modules = array();
  254. foreach (module_implements('help', TRUE) as $module) {
  255. if (module_invoke($module, 'help', "admin/help#$module", $empty_arg)) {
  256. $modules[$module] = $module_info[$module]->info['name'];
  257. }
  258. }
  259. asort($modules);
  260. $links = array();
  261. foreach ($modules as $module => $name) {
  262. $links[] = array('title' => $name, 'href' => "admin/help/{$module}");
  263. }
  264. $vars['links'] = theme('links', array('links' => $links));
  265. }
  266. /**
  267. * Preprocessor for theme('node').
  268. */
  269. function rubik_preprocess_node(&$vars) {
  270. $vars['layout'] = TRUE;
  271. if ($vars['display_submitted']) {
  272. $vars['submitted'] = _rubik_submitted($vars['node']);
  273. }
  274. }
  275. /**
  276. * Preprocessor for theme('comment').
  277. */
  278. function rubik_preprocess_comment(&$vars) {
  279. $vars['layout'] = TRUE;
  280. $vars['submitted'] = _rubik_submitted($vars['comment']);
  281. }
  282. /**
  283. * Preprocessor for theme('comment_wrapper').
  284. */
  285. function rubik_preprocess_comment_wrapper(&$vars) {
  286. $vars['hook'] = 'box';
  287. $vars['layout'] = FALSE;
  288. $vars['title'] = t('Comments');
  289. $vars['attributes_array']['id'] = 'comments';
  290. $vars['title_attributes_array']['class'][] = 'box-title';
  291. $vars['title_attributes_array']['class'][] = 'clearfix';
  292. $vars['content_attributes_array']['class'][] = 'box-content';
  293. $vars['content_attributes_array']['class'][] = 'clearfix';
  294. $vars['content_attributes_array']['class'][] = 'prose';
  295. $vars['content'] = drupal_render_children($vars['content']);
  296. }
  297. /**
  298. * Preprocessor for theme('admin_block').
  299. */
  300. function rubik_preprocess_admin_block(&$vars) {
  301. // Add icon and classes to admin block titles.
  302. if (isset($vars['block']['href'])) {
  303. $vars['block']['localized_options']['attributes']['class'] = _rubik_icon_classes($vars['block']['href']);
  304. }
  305. $vars['block']['localized_options']['html'] = TRUE;
  306. if (isset($vars['block']['link_title'])) {
  307. $vars['block']['title'] = l("<span class='icon'></span>" . filter_xss_admin($vars['block']['title']), $vars['block']['href'], $vars['block']['localized_options']);
  308. }
  309. if (empty($vars['block']['content'])) {
  310. $vars['block']['content'] = "<div class='admin-block-description description'>{$vars['block']['description']}</div>";
  311. }
  312. }
  313. /**
  314. * Override of theme('breadcrumb').
  315. */
  316. function rubik_breadcrumb($vars) {
  317. $output = '';
  318. // Add current page onto the end.
  319. if (!drupal_is_front_page()) {
  320. $item = menu_get_item();
  321. $end = end($vars['breadcrumb']);
  322. if ($end && strip_tags($end) !== $item['title']) {
  323. $vars['breadcrumb'][] = check_plain($item['title']);
  324. }
  325. }
  326. // Optional: Add the site name to the front of the stack.
  327. if (!empty($vars['prepend'])) {
  328. $site_name = empty($vars['breadcrumb']) ? "<strong>". check_plain(variable_get('site_name', '')) ."</strong>" : l(variable_get('site_name', ''), '<front>', array('purl' => array('disabled' => TRUE)));
  329. array_unshift($vars['breadcrumb'], $site_name);
  330. }
  331. $depth = 0;
  332. foreach ($vars['breadcrumb'] as $link) {
  333. // If the item isn't a link, surround it with a strong tag to format it like
  334. // one.
  335. if (!preg_match('/^<a/', $link) && !preg_match('/^<strong/', $link)) {
  336. $link = '<strong>' . $link . '</strong>';
  337. }
  338. $output .= "<span class='breadcrumb-link breadcrumb-depth-{$depth}'>{$link}</span>";
  339. $depth++;
  340. }
  341. return $output;
  342. }
  343. /**
  344. * Override of theme('filter_guidelines').
  345. */
  346. function rubik_filter_guidelines($variables) {
  347. return '';
  348. }
  349. /**
  350. * Override of theme('node_add_list').
  351. */
  352. function rubik_node_add_list($vars) {
  353. $content = $vars['content'];
  354. $output = "<ul class='admin-list'>";
  355. if ($content) {
  356. foreach ($content as $item) {
  357. $item['title'] = "<span class='icon'></span>" . filter_xss_admin($item['title']);
  358. if (isset($item['localized_options']['attributes']['class'])) {
  359. $item['localized_options']['attributes']['class'] += _rubik_icon_classes($item['href']);
  360. }
  361. else {
  362. $item['localized_options']['attributes']['class'] = _rubik_icon_classes($item['href']);
  363. }
  364. $item['localized_options']['html'] = TRUE;
  365. $output .= "<li>";
  366. $output .= l($item['title'], $item['href'], $item['localized_options']);
  367. $output .= '<div class="description">'. filter_xss_admin($item['description']) .'</div>';
  368. $output .= "</li>";
  369. }
  370. }
  371. $output .= "</ul>";
  372. return $output;
  373. }
  374. /**
  375. * Override of theme_admin_block_content().
  376. */
  377. function rubik_admin_block_content($vars) {
  378. $content = $vars['content'];
  379. $output = '';
  380. if (!empty($content)) {
  381. foreach ($content as $k => $item) {
  382. //-- Safety check for invalid clients of the function
  383. if (empty($content[$k]['localized_options']['attributes']['class'])) {
  384. $content[$k]['localized_options']['attributes']['class'] = array();
  385. }
  386. if (!is_array($content[$k]['localized_options']['attributes']['class'])) {
  387. $content[$k]['localized_options']['attributes']['class'] = array($content[$k]['localized_options']['attributes']['class']);
  388. }
  389. $content[$k]['title'] = "<span class='icon'></span>" . filter_xss_admin($item['title']);
  390. $content[$k]['localized_options']['html'] = TRUE;
  391. if (!empty($content[$k]['localized_options']['attributes']['class'])) {
  392. $content[$k]['localized_options']['attributes']['class'] += _rubik_icon_classes($item['href']);
  393. }
  394. else {
  395. $content[$k]['localized_options']['attributes']['class'] = _rubik_icon_classes($item['href']);
  396. }
  397. }
  398. $output = system_admin_compact_mode() ? '<ul class="admin-list admin-list-compact">' : '<ul class="admin-list">';
  399. foreach ($content as $item) {
  400. $output .= '<li class="leaf">';
  401. $output .= l($item['title'], $item['href'], $item['localized_options']);
  402. if (isset($item['description']) && !system_admin_compact_mode()) {
  403. $output .= "<div class='description'>{$item['description']}</div>";
  404. }
  405. $output .= '</li>';
  406. }
  407. $output .= '</ul>';
  408. }
  409. return $output;
  410. }
  411. /**
  412. * Override of theme('admin_drilldown_menu_item_link').
  413. */
  414. function rubik_admin_drilldown_menu_item_link($link) {
  415. $link['localized_options'] = empty($link['localized_options']) ? array() : $link['localized_options'];
  416. $link['localized_options']['html'] = TRUE;
  417. if (!isset($link['localized_options']['attributes']['class'])) {
  418. $link['localized_options']['attributes']['class'] = _rubik_icon_classes($link['href']);
  419. }
  420. else {
  421. $link['localized_options']['attributes']['class'] += _rubik_icon_classes($link['href']);
  422. }
  423. $link['description'] = check_plain(truncate_utf8(strip_tags($link['description']), 150, TRUE, TRUE));
  424. $link['description'] = "<span class='icon'></span>" . $link['description'];
  425. $link['title'] .= !empty($link['description']) ? "<span class='menu-description'>{$link['description']}</span>" : '';
  426. $link['title'] = filter_xss_admin($link['title']);
  427. return l($link['title'], $link['href'], $link['localized_options']);
  428. }
  429. /**
  430. * Preprocessor for theme('textfield').
  431. */
  432. function rubik_preprocess_textfield(&$vars) {
  433. if ($vars['element']['#size'] >= 30 && empty($vars['element']['#field_prefix']) && empty($vars['element']['#field_suffix'])) {
  434. $vars['element']['#size'] = '';
  435. if (!isset($vars['element']['#attributes']['class'])
  436. || !is_array($vars['element']['#attributes']['class'])) {
  437. $vars['element']['#attributes']['class'] = array();
  438. }
  439. $vars['element']['#attributes']['class'][] = 'fluid';
  440. }
  441. }
  442. /**
  443. * Override of theme('menu_local_task').
  444. */
  445. function rubik_menu_local_task($variables) {
  446. $link = $variables['element']['#link'];
  447. $link_text = $link['title'];
  448. if (!empty($variables['element']['#active'])) {
  449. // Add text to indicate active tab for non-visual users.
  450. $active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
  451. // If the link does not contain HTML already, check_plain() it now.
  452. // After we set 'html'=TRUE the link will not be sanitized by l().
  453. if (empty($link['localized_options']['html'])) {
  454. $link['title'] = check_plain($link['title']);
  455. }
  456. $link['localized_options']['html'] = TRUE;
  457. $link_text = t('!local-task-title!active', array('!local-task-title' => $link['title'], '!active' => $active));
  458. }
  459. // Render child tasks if available.
  460. $children = '';
  461. if (element_children($variables['element'])) {
  462. $children = drupal_render_children($variables['element']);
  463. $children = "<ul class='secondary-tabs links clearfix'>{$children}</ul>";
  464. }
  465. return '<li' . (!empty($variables['element']['#active']) ? ' class="active"' : '') . '>' . l($link_text, $link['href'], $link['localized_options']) . $children . "</li>\n";
  466. }
  467. /**
  468. * Helper function for cloning and drupal_render()'ing elements.
  469. */
  470. function rubik_render_clone($elements) {
  471. static $instance;
  472. if (!isset($instance)) {
  473. $instance = 1;
  474. }
  475. foreach (element_children($elements) as $key) {
  476. if (isset($elements[$key]['#id'])) {
  477. $elements[$key]['#id'] = "{$elements[$key]['#id']}-{$instance}";
  478. }
  479. }
  480. $instance++;
  481. return drupal_render($elements);
  482. }
  483. function rubik_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
  484. $rubik_sidebar_field_ui = theme_get_setting('rubik_sidebar_field_ui', 'rubik');
  485. $rubik_disable_sidebar_in_form = theme_get_setting('rubik_disable_sidebar_in_form', 'rubik');
  486. if ($rubik_sidebar_field_ui == 1 && $rubik_disable_sidebar_in_form == 0) {
  487. $options = array(
  488. 'default' => t('Default'),
  489. 'rubik_sidebar_field' => t('Sidebar'),
  490. );
  491. $default = (isset($form_state['build_info']['args'][0]['rubik_edit_field_display'])) ? $form_state['build_info']['args'][0]['rubik_edit_field_display'] : 'default';
  492. $form['instance']['rubik_edit_field_display'] = array(
  493. '#type' => 'radios',
  494. '#title' => t('Set field display location'),
  495. '#description' => t('Choose where this field should be displayed.'),
  496. '#default_value' => $default,
  497. '#options' => $options,
  498. );
  499. }
  500. }
  501. function rubik_form_node_form_alter(&$form, $form_state) {
  502. $rubik_sidebar_field_ui = theme_get_setting('rubik_sidebar_field_ui', 'rubik');
  503. if ($rubik_sidebar_field_ui == TRUE) {
  504. if (isset($form_state['field']) && is_array($form_state['field'])) {
  505. foreach ($form_state['field'] AS $name => $field) {
  506. if (!isset($field[LANGUAGE_NONE]['instance'])) {
  507. continue;
  508. }
  509. if (isset($field[LANGUAGE_NONE]['instance']['rubik_edit_field_display'])) {
  510. $display = $field[LANGUAGE_NONE]['instance']['rubik_edit_field_display'];
  511. if ($display == 'rubik_sidebar_field') {
  512. $form[$name]['#attributes']['class'][] = 'rubik_sidebar_field';
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519. /**
  520. * Helper function to submitted info theming functions.
  521. */
  522. function _rubik_submitted($node) {
  523. $byline = t('Posted by !username', array('!username' => theme('username', array('account' => $node))));
  524. $date = format_date($node->created, 'small');
  525. return "<div class='byline'>{$byline}</div><div class='date'>$date</div>";
  526. }
  527. /**
  528. * Generate an icon class from a path.
  529. */
  530. function _rubik_icon_classes($path) {
  531. $classes = array();
  532. $args = explode('/', $path);
  533. if ($args[0] === 'admin' || (count($args) > 1 && $args[0] === 'node' && $args[1] === 'add')) {
  534. // Add a class specifically for the current path that allows non-cascading
  535. // style targeting.
  536. $classes[] = 'path-'. str_replace('/', '-', implode('/', $args)) . '-';
  537. while (count($args)) {
  538. $classes[] = drupal_html_class('path-'. str_replace('/', '-', implode('/', $args)));
  539. array_pop($args);
  540. }
  541. return $classes;
  542. }
  543. return array();
  544. }
  545. function _rubik_local_tasks(&$vars) {
  546. if (!empty($vars['secondary_local_tasks']) && is_array($vars['primary_local_tasks'])) {
  547. foreach ($vars['primary_local_tasks'] as $key => $element) {
  548. if (!empty($element['#active'])) {
  549. $vars['primary_local_tasks'][$key] = $vars['primary_local_tasks'][$key] + $vars['secondary_local_tasks'];
  550. break;
  551. }
  552. }
  553. }
  554. }