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
theme_zurb_foundation_menu_link Theme function to render a single top bar menu link.
theme_zurb_foundation_reveal Theme function to create Zurb Foundation reveal modals.
zurb_foundation_breadcrumb Implements theme_breadrumb().
zurb_foundation_css_alter Implements hook_css_alter()
zurb_foundation_entity_variables Add default classes to Display Suite regions if none are set.
zurb_foundation_field
zurb_foundation_field__taxonomy_term_reference Implements theme_field__field_type().
zurb_foundation_html_head_alter Implements hook_html_head_alter().
zurb_foundation_links__dropdown_button Implements theme_links() with foundations dropdown button markup.
zurb_foundation_links__magic_button Helper function to output a single link as button or multiple links as dropdown/split buttons.
zurb_foundation_links__split_button Implements theme_links() with foundations split button markup.
zurb_foundation_links__topbar_main_menu Implements theme_links() targeting the main menu specifically. Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html
zurb_foundation_links__topbar_secondary_menu Implements theme_links() targeting the secondary menu specifically. Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html
zurb_foundation_pager Replace Drupal pagers with Foundation pagers.
zurb_foundation_preprocess_block
zurb_foundation_preprocess_field Implements template_preprocess_field().
zurb_foundation_preprocess_html Implements template_preprocess_html().
zurb_foundation_preprocess_node Implements template_preprocess_node
zurb_foundation_preprocess_page Implements template_preprocess_page
zurb_foundation_process_html_tag Implements hook_process_html_tag()
zurb_foundation_theme Implements hook_theme().
zurb_foundation_theme_registry_alter Implements hook_theme_registry_alter().
_zurb_foundation_add_reveals Add the reveal modal markup (if any) to the page_bottom region.
_zurb_foundation_links Helper function to output a Drupal menu as a Foundation Top Bar.
_zurb_foundation_load
_zurb_foundation_render_link Helper function to recursively render sub-menus.
_zurb_foundation_reveal Helper function to store and return markup for reveal modals on the page. This is necessary because we need to add all of the reveals to the bottom of the page to avoid unexpected behavior. For more information please refer to the official Zurb…

File

sites/all/themes/local_contrib/zurb-foundation/template.php
View source
  1. <?php
  2. /*
  3. * @file
  4. */
  5. $files = array(
  6. 'elements.inc',
  7. 'form.inc',
  8. 'menu.inc',
  9. 'theme.inc',
  10. );
  11. function _zurb_foundation_load($files) {
  12. $tp = drupal_get_path('theme', 'zurb_foundation');
  13. $file = '';
  14. $dir = dirname(__FILE__);
  15. // Check file path and '.inc' extension
  16. foreach($files as $file) {
  17. $file_path = $dir . '/inc/' . $file;
  18. if (strpos($file,'.inc') > 0 && file_exists($file_path)) {
  19. require_once($file_path);
  20. }
  21. }
  22. }
  23. _zurb_foundation_load($files);
  24. /**
  25. * Implements hook_html_head_alter().
  26. */
  27. function zurb_foundation_html_head_alter(&$head_elements) {
  28. // HTML5 charset declaration.
  29. $head_elements['system_meta_content_type']['#attributes'] = array(
  30. 'charset' => 'utf-8',
  31. );
  32. // Optimize mobile viewport.
  33. $head_elements['mobile_viewport'] = array(
  34. '#type' => 'html_tag',
  35. '#tag' => 'meta',
  36. '#attributes' => array(
  37. 'name' => 'viewport',
  38. 'content' => 'width=device-width, maximum-scale = 1.0',
  39. ),
  40. );
  41. // Remove image toolbar in IE.
  42. $head_elements['ie_image_toolbar'] = array(
  43. '#type' => 'html_tag',
  44. '#tag' => 'meta',
  45. '#attributes' => array(
  46. 'http-equiv' => 'ImageToolbar',
  47. 'content' => 'false',
  48. ),
  49. );
  50. }
  51. /**
  52. * Implements theme_breadrumb().
  53. *
  54. * Print breadcrumbs as a list, with separators.
  55. */
  56. function zurb_foundation_breadcrumb($variables) {
  57. $breadcrumb = $variables['breadcrumb'];
  58. if (!empty($breadcrumb)) {
  59. // Provide a navigational heading to give context for breadcrumb links to
  60. // screen-reader users. Make the heading invisible with .element-invisible.
  61. $breadcrumbs = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
  62. $breadcrumbs .= '<ul class="breadcrumbs">';
  63. foreach ($breadcrumb as $key => $value) {
  64. $breadcrumbs .= '<li>' . $value . '</li>';
  65. }
  66. $title = strip_tags(drupal_get_title());
  67. $breadcrumbs .= '<li class="current"><a href="#">' . $title. '</a></li>';
  68. $breadcrumbs .= '</ul>';
  69. return $breadcrumbs;
  70. }
  71. }
  72. function zurb_foundation_field($variables) {
  73. $output = '';
  74. // Render the label, if it's not hidden.
  75. if (!$variables['label_hidden']) {
  76. $output .= '<div ' . $variables['title_attributes'] . '>' . $variables['label'] . ':&nbsp;</div>';
  77. }
  78. // Edit module requires some extra wrappers to work.
  79. if (module_exists('edit')) {
  80. $output .= '<div class="field-items"' . $variables['content_attributes'] . '>';
  81. foreach ($variables['items'] as $delta => $item) {
  82. $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
  83. $output .= '<div class="' . $classes . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</div>';
  84. }
  85. $output .= '</div>';
  86. }
  87. else {
  88. foreach ($variables['items'] as $item) {
  89. $output .= drupal_render($item);
  90. }
  91. }
  92. // Render the top-level DIV.
  93. $output = '<div class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</div>';
  94. return $output;
  95. }
  96. /**
  97. * Implements theme_field__field_type().
  98. */
  99. function zurb_foundation_field__taxonomy_term_reference($variables) {
  100. $output = '';
  101. // Render the label, if it's not hidden.
  102. if (!$variables['label_hidden']) {
  103. $output .= '<h2 class="field-label">' . $variables['label'] . ': </h2>';
  104. }
  105. // Render the items.
  106. $output .= ($variables['element']['#label_display'] == 'inline') ? '<ul class="links inline">' : '<ul class="links">';
  107. foreach ($variables['items'] as $delta => $item) {
  108. $output .= '<li class="taxonomy-term-reference-' . $delta . '"' . $variables['item_attributes'][$delta] . '>' . drupal_render($item) . '</li>';
  109. }
  110. $output .= '</ul>';
  111. // Render the top-level DIV.
  112. $output = '<div class="' . $variables['classes'] . (!in_array('clearfix', $variables['classes_array']) ? ' clearfix' : '') . '">' . $output . '</div>';
  113. return $output;
  114. }
  115. /**
  116. * Implements theme_links() targeting the main menu specifically.
  117. * Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html
  118. */
  119. function zurb_foundation_links__topbar_main_menu($variables) {
  120. // We need to fetch the links ourselves because we need the entire tree.
  121. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_main_links_source', 'main-menu')));
  122. $output = _zurb_foundation_links($links);
  123. $variables['attributes']['class'][] = 'left';
  124. return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
  125. }
  126. /**
  127. * Implements theme_links() targeting the secondary menu specifically.
  128. * Formats links for Top Bar http://foundation.zurb.com/docs/components/top-bar.html
  129. */
  130. function zurb_foundation_links__topbar_secondary_menu($variables) {
  131. // We need to fetch the links ourselves because we need the entire tree.
  132. $links = menu_tree_output(menu_tree_all_data(variable_get('menu_secondary_links_source', 'user-menu')));
  133. $output = _zurb_foundation_links($links);
  134. $variables['attributes']['class'][] = 'right';
  135. return '<ul' . drupal_attributes($variables['attributes']) . '>' . $output . '</ul>';
  136. }
  137. /**
  138. * Helper function to output a Drupal menu as a Foundation Top Bar.
  139. *
  140. * @param array
  141. * An array of menu links.
  142. *
  143. * @return string
  144. * A rendered list of links, with no <ul> or <ol> wrapper.
  145. *
  146. * @see zurb_foundation_links__system_main_menu()
  147. * @see zurb_foundation_links__system_secondary_menu()
  148. */
  149. function _zurb_foundation_links($links) {
  150. $output = '';
  151. foreach (element_children($links) as $key) {
  152. $output .= _zurb_foundation_render_link($links[$key]);
  153. }
  154. return $output;
  155. }
  156. /**
  157. * Helper function to recursively render sub-menus.
  158. *
  159. * @param array
  160. * An array of menu links.
  161. *
  162. * @return string
  163. * A rendered list of links, with no <ul> or <ol> wrapper.
  164. *
  165. * @see _zurb_foundation_links()
  166. */
  167. function _zurb_foundation_render_link($link) {
  168. $output = '';
  169. // This is a duplicate link that won't get the dropdown class and will only
  170. // show up in small-screen.
  171. $small_link = $link;
  172. if (!empty($link['#below'])) {
  173. $link['#attributes']['class'][] = 'has-dropdown';
  174. }
  175. // Render top level and make sure we have an actual link.
  176. if (!empty($link['#href'])) {
  177. $rendered_link = NULL;
  178. // Foundation offers some of the same functionality as Special Menu Items;
  179. // ie: Dividers and Labels in the top bar. So let's make sure that we
  180. // render them the Foundation way.
  181. if (module_exists('special_menu_items')) {
  182. if ($link['#href'] === '<nolink>') {
  183. $rendered_link = '<label>' . $link['#title'] . '</label>';
  184. }
  185. else if ($link['#href'] === '<separator>') {
  186. $link['#attributes']['class'][] = 'divider';
  187. $rendered_link = '';
  188. }
  189. }
  190. if (!isset($rendered_link)) {
  191. $rendered_link = theme('zurb_foundation_menu_link', array('link' => $link));
  192. }
  193. // Test for localization options and apply them if they exist.
  194. if (isset($link['#localized_options']['attributes']) && is_array($link['#localized_options']['attributes'])) {
  195. $link['#attributes'] = array_merge_recursive($link['#attributes'], $link['#localized_options']['attributes']);
  196. }
  197. $output .= '<li' . drupal_attributes($link['#attributes']) . '>' . $rendered_link;
  198. if (!empty($link['#below'])) {
  199. // Add repeated link under the dropdown for small-screen.
  200. $small_link['#attributes']['class'][] = 'show-for-small';
  201. $sub_menu = '<li' . drupal_attributes($small_link['#attributes']) . '>' . l($link['#title'], $link['#href'], $link['#localized_options']);
  202. // Build sub nav recursively.
  203. foreach ($link['#below'] as $sub_link) {
  204. if (!empty($sub_link['#href'])) {
  205. $sub_menu .= _zurb_foundation_render_link($sub_link);
  206. }
  207. }
  208. $output .= '<ul class="dropdown">' . $sub_menu . '</ul>';
  209. }
  210. $output .= '</li>';
  211. }
  212. return $output;
  213. }
  214. /**
  215. * Theme function to render a single top bar menu link.
  216. */
  217. function theme_zurb_foundation_menu_link($variables) {
  218. $link = $variables['link'];
  219. return l($link['#title'], $link['#href'], $link['#localized_options']);
  220. }
  221. /*
  222. * Implements hook_preprocess_block()
  223. */
  224. function zurb_foundation_preprocess_block(&$variables) {
  225. // Convenience variable for block headers.
  226. $title_class = &$variables['title_attributes_array']['class'];
  227. // Generic block header class.
  228. $title_class[] = 'block-title';
  229. // In the header region visually hide block titles.
  230. if ($variables['block']->region == 'header') {
  231. $title_class[] = 'element-invisible';
  232. }
  233. // Add a unique class for each block for styling.
  234. $variables['classes_array'][] = $variables['block_html_id'];
  235. // Add classes based on region.
  236. switch ($variables['elements']['#block']->region) {
  237. // Clear blocks in this region
  238. case 'sidebar_first':
  239. $variables['classes_array'][] = 'clearfix';
  240. break;
  241. // Add a striping class & clear blocks in this region
  242. case 'sidebar_second':
  243. $variables['classes_array'][] = 'block-' . $variables['zebra'];
  244. $variables['classes_array'][] = 'clearfix';
  245. break;
  246. case 'header':
  247. $variables['classes_array'][] = 'header';
  248. break;
  249. default;
  250. }
  251. }
  252. /**
  253. * Implements template_preprocess_field().
  254. */
  255. function zurb_foundation_preprocess_field(&$variables) {
  256. $variables['title_attributes_array']['class'][] = 'field-label';
  257. // Edit classes for taxonomy term reference fields.
  258. if ($variables['field_type_css'] == 'taxonomy-term-reference') {
  259. $variables['content_attributes_array']['class'][] = 'comma-separated';
  260. }
  261. // Convenience variables.
  262. $name = $variables['element']['#field_name'];
  263. $bundle = $variables['element']['#bundle'];
  264. $mode = $variables['element']['#view_mode'];
  265. $classes = &$variables['classes_array'];
  266. $title_classes = &$variables['title_attributes_array']['class'];
  267. $content_classes = &$variables['content_attributes_array']['class'];
  268. $item_classes = array();
  269. // Global field classes.
  270. $classes[] = 'field-wrapper';
  271. $content_classes[] = 'field-items';
  272. $item_classes[] = 'field-item';
  273. // Uncomment the lines below to see variables you can use to target a field.
  274. // print '<strong>Name:</strong> ' . $name . '<br/>';
  275. // print '<strong>Bundle:</strong> ' . $bundle . '<br/>';
  276. // print '<strong>Mode:</strong> ' . $mode .'<br/>';
  277. // Add specific classes to targeted fields.
  278. if(isset($field)) {
  279. switch ($mode) {
  280. // All teasers.
  281. case 'teaser':
  282. switch ($field) {
  283. // Teaser read more links.
  284. case 'node_link':
  285. $item_classes[] = 'more-link';
  286. break;
  287. // Teaser descriptions.
  288. case 'body':
  289. case 'field_description':
  290. $item_classes[] = 'description';
  291. break;
  292. }
  293. break;
  294. }
  295. }
  296. // Check if exists
  297. // switch ($field) {
  298. // case 'field_authors':
  299. // $title_classes[] = 'inline';
  300. // $content_classes[] = 'authors';
  301. // $item_classes[] = 'author';
  302. // break;
  303. // }
  304. // Apply odd or even classes along with our custom classes to each item.
  305. foreach ($variables['items'] as $delta => $item) {
  306. $item_classes[] = $delta % 2 ? 'odd' : 'even';
  307. $variables['item_attributes_array'][$delta]['class'] = $item_classes;
  308. }
  309. // Add class to a specific fields across content types.
  310. switch ($variables['element']['#field_name']) {
  311. case 'body':
  312. $variables['classes_array'][] = 'body';
  313. break;
  314. case 'field_summary':
  315. $variables['classes_array'][] = 'text-teaser';
  316. break;
  317. case 'field_link':
  318. case 'field_date':
  319. // Replace classes entirely, instead of adding extra.
  320. $variables['classes_array'] = array('text-content');
  321. break;
  322. case 'field_image':
  323. // Replace classes entirely, instead of adding extra.
  324. $variables['classes_array'] = array('image');
  325. break;
  326. default:
  327. break;
  328. }
  329. // Add classes to body based on content type and view mode.
  330. if ($variables['element']['#field_name'] == 'body') {
  331. // Add classes to Foobar content type.
  332. if ($variables['element']['#bundle'] == 'foobar') {
  333. $variables['classes_array'][] = 'text-secondary';
  334. }
  335. // Add classes to other content types with view mode 'teaser';
  336. elseif ($variables['element']['#view_mode'] == 'teaser') {
  337. $variables['classes_array'][] = 'text-secondary';
  338. }
  339. // The rest is text-content.
  340. else {
  341. $variables['classes_array'][] = 'field';
  342. }
  343. }
  344. }
  345. /**
  346. * Implements template_preprocess_html().
  347. *
  348. * Adds additional classes.
  349. */
  350. function zurb_foundation_preprocess_html(&$variables) {
  351. global $language;
  352. // Clean up the lang attributes
  353. $variables['html_attributes'] = 'lang="' . $language->language . '" dir="' . $language->dir . '"';
  354. // Add language body class.
  355. if (function_exists('locale')) {
  356. $variables['classes_array'][] = 'lang-' . $variables['language']->language;
  357. }
  358. // @TODO Custom fonts from Google web-fonts
  359. // $font = str_replace(' ', '+', theme_get_setting('zurb_foundation_font'));
  360. // if (theme_get_setting('zurb_foundation_font')) {
  361. // drupal_add_css('http://fonts.googleapis.com/css?family=' . $font , array('type' => 'external', 'group' => CSS_THEME));
  362. // }
  363. // Classes for body element. Allows advanced theming based on context
  364. if (!$variables['is_front']) {
  365. // Add unique class for each page.
  366. $path = drupal_get_path_alias($_GET['q']);
  367. // Add unique class for each website section.
  368. list($section, ) = explode('/', $path, 2);
  369. $arg = explode('/', $_GET['q']);
  370. if ($arg[0] == 'node' && isset($arg[1])) {
  371. if ($arg[1] == 'add') {
  372. $section = 'node-add';
  373. }
  374. elseif (isset($arg[2]) && is_numeric($arg[1]) && ($arg[2] == 'edit' || $arg[2] == 'delete')) {
  375. $section = 'node-' . $arg[2];
  376. }
  377. }
  378. $variables['classes_array'][] = drupal_html_class('section-' . $section);
  379. }
  380. // Store the menu item since it has some useful information.
  381. $variables['menu_item'] = menu_get_item();
  382. if ($variables['menu_item']) {
  383. switch ($variables['menu_item']['page_callback']) {
  384. case 'views_page':
  385. $variables['classes_array'][] = 'views-page';
  386. break;
  387. case 'page_manager_page_execute':
  388. case 'page_manager_node_view':
  389. case 'page_manager_contact_site':
  390. $variables['classes_array'][] = 'panels-page';
  391. break;
  392. }
  393. }
  394. }
  395. /**
  396. * Implements template_preprocess_node
  397. *
  398. * Add template suggestions and classes.
  399. */
  400. function zurb_foundation_preprocess_node(&$variables) {
  401. // Add node--node_type--view_mode.tpl.php suggestions.
  402. $variables['theme_hook_suggestions'][] = 'node__' . $variables['type'] . '__' . $variables['view_mode'];
  403. // Add node--view_mode.tpl.php suggestions.
  404. $variables['theme_hook_suggestions'][] = 'node__' . $variables['view_mode'];
  405. // Add a class for the view mode.
  406. if (!$variables['teaser']) {
  407. $variables['classes_array'][] = 'view-mode-' . $variables['view_mode'];
  408. }
  409. $variables['title_attributes_array']['class'][] = 'node-title';
  410. }
  411. /**
  412. * Implements template_preprocess_page
  413. *
  414. * Add convenience variables and template suggestions.
  415. */
  416. function zurb_foundation_preprocess_page(&$variables) {
  417. // Add page--node_type.tpl.php suggestions
  418. if (!empty($variables['node'])) {
  419. $variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
  420. }
  421. $variables['logo_img'] = '';
  422. if (!empty($variables['logo'])) {
  423. $variables['logo_img'] = theme('image', array(
  424. 'path' => $variables['logo'],
  425. 'alt' => strip_tags($variables['site_name']) . ' ' . t('logo'),
  426. 'title' => strip_tags($variables['site_name']) . ' ' . t('Home'),
  427. 'attributes' => array(
  428. 'class' => array('logo'),
  429. ),
  430. ));
  431. }
  432. $variables['linked_logo'] = '';
  433. if (!empty($variables['logo_img'])) {
  434. $variables['linked_logo'] = l($variables['logo_img'], '<front>', array(
  435. 'attributes' => array(
  436. 'rel' => 'home',
  437. 'title' => strip_tags($variables['site_name']) . ' ' . t('Home'),
  438. ),
  439. 'html' => TRUE,
  440. ));
  441. }
  442. $variables['linked_site_name'] = '';
  443. if (!empty($variables['site_name'])) {
  444. $variables['linked_site_name'] = l($variables['site_name'], '<front>', array(
  445. 'attributes' => array(
  446. 'rel' => 'home',
  447. 'title' => strip_tags($variables['site_name']) . ' ' . t('Home'),
  448. ),
  449. ));
  450. }
  451. // Top bar.
  452. if ($variables['top_bar'] = theme_get_setting('zurb_foundation_top_bar_enable')) {
  453. $top_bar_classes = array();
  454. if (theme_get_setting('zurb_foundation_top_bar_grid')) {
  455. $top_bar_classes[] = 'contain-to-grid';
  456. }
  457. if (theme_get_setting('zurb_foundation_top_bar_sticky')) {
  458. $top_bar_classes[] = 'sticky';
  459. }
  460. if ($variables['top_bar'] == 2) {
  461. $top_bar_classes[] = 'show-for-small';
  462. }
  463. $variables['top_bar_classes'] = implode(' ', $top_bar_classes);
  464. $variables['top_bar_menu_text'] = check_plain(theme_get_setting('zurb_foundation_top_bar_menu_text'));
  465. $top_bar_options = array();
  466. if (!theme_get_setting('zurb_foundation_top_bar_custom_back_text')) {
  467. $top_bar_options[] = 'custom_back_text:false';
  468. }
  469. if ($back_text = check_plain(theme_get_setting('zurb_foundation_top_bar_back_text'))) {
  470. if ($back_text !== 'Back') {
  471. $top_bar_options[] = "back_text:'{$back_text}'";
  472. }
  473. }
  474. if (!theme_get_setting('zurb_foundation_top_bar_is_hover')) {
  475. $top_bar_options[] = 'is_hover:false';
  476. }
  477. if (!theme_get_setting('zurb_foundation_top_bar_scrolltop')) {
  478. $top_bar_options[] = 'scrolltop:false';
  479. }
  480. $variables['top_bar_options'] = ' data-options="' . implode('; ', $top_bar_options) . '"';
  481. }
  482. // Alternative header.
  483. // This is what will show up if the top bar is disabled or enabled only for
  484. // mobile.
  485. if ($variables['alt_header'] = ($variables['top_bar'] != 1)) {
  486. // Hide alt header on mobile if using top bar in mobile.
  487. $variables['alt_header_classes'] = $variables['top_bar'] == 2 ? ' hide-for-small' : '';
  488. }
  489. // Menus for alternative header.
  490. $variables['alt_main_menu'] = '';
  491. if (!empty($variables['main_menu'])) {
  492. $variables['alt_main_menu'] = theme('links__system_main_menu', array(
  493. 'links' => $variables['main_menu'],
  494. 'attributes' => array(
  495. 'id' => 'main-menu-links',
  496. 'class' => array('links', 'inline-list', 'clearfix'),
  497. ),
  498. 'heading' => array(
  499. 'text' => t('Main menu'),
  500. 'level' => 'h2',
  501. 'class' => array('element-invisible'),
  502. ),
  503. ));
  504. }
  505. $variables['alt_secondary_menu'] = '';
  506. if (!empty($variables['secondary_menu'])) {
  507. $variables['alt_secondary_menu'] = theme('links__system_secondary_menu', array(
  508. 'links' => $variables['secondary_menu'],
  509. 'attributes' => array(
  510. 'id' => 'secondary-menu-links',
  511. 'class' => array('links', 'clearfix'),
  512. ),
  513. 'heading' => array(
  514. 'text' => t('Secondary menu'),
  515. 'level' => 'h2',
  516. 'class' => array('element-invisible'),
  517. ),
  518. ));
  519. }
  520. // Top bar menus.
  521. $variables['top_bar_main_menu'] = '';
  522. if (!empty($variables['main_menu'])) {
  523. $variables['top_bar_main_menu'] = theme('links__topbar_main_menu', array(
  524. 'links' => $variables['main_menu'],
  525. 'attributes' => array(
  526. 'id' => 'main-menu',
  527. 'class' => array('main-nav'),
  528. ),
  529. 'heading' => array(
  530. 'text' => t('Main menu'),
  531. 'level' => 'h2',
  532. 'class' => array('element-invisible'),
  533. ),
  534. ));
  535. }
  536. $variables['top_bar_secondary_menu'] = '';
  537. if (!empty($variables['secondary_menu'])) {
  538. $variables['top_bar_secondary_menu'] = theme('links__topbar_secondary_menu', array(
  539. 'links' => $variables['secondary_menu'],
  540. 'attributes' => array(
  541. 'id' => 'secondary-menu',
  542. 'class' => array('secondary', 'link-list'),
  543. ),
  544. 'heading' => array(
  545. 'text' => t('Secondary menu'),
  546. 'level' => 'h2',
  547. 'class' => array('element-invisible'),
  548. ),
  549. ));
  550. }
  551. // Messages in modal.
  552. $variables['zurb_foundation_messages_modal'] = theme_get_setting('zurb_foundation_messages_modal');
  553. // Convenience variables
  554. if (!empty($variables['page']['sidebar_first'])){
  555. $left = $variables['page']['sidebar_first'];
  556. }
  557. if (!empty($variables['page']['sidebar_second'])) {
  558. $right = $variables['page']['sidebar_second'];
  559. }
  560. // Dynamic sidebars
  561. if (!empty($left) && !empty($right)) {
  562. $variables['main_grid'] = 'large-6 push-3';
  563. $variables['sidebar_first_grid'] = 'large-3 pull-6';
  564. $variables['sidebar_sec_grid'] = 'large-3';
  565. } elseif (empty($left) && !empty($right)) {
  566. $variables['main_grid'] = 'large-9';
  567. $variables['sidebar_first_grid'] = '';
  568. $variables['sidebar_sec_grid'] = 'large-3';
  569. } elseif (!empty($left) && empty($right)) {
  570. $variables['main_grid'] = 'large-9 push-3';
  571. $variables['sidebar_first_grid'] = 'large-3 pull-9';
  572. $variables['sidebar_sec_grid'] = '';
  573. } else {
  574. $variables['main_grid'] = 'large-12';
  575. $variables['sidebar_first_grid'] = '';
  576. $variables['sidebar_sec_grid'] = '';
  577. }
  578. // Ensure modal reveal behavior if modal messages are enabled.
  579. if(theme_get_setting('zurb_foundation_messages_modal')) {
  580. drupal_add_js(drupal_get_path('theme', 'zurb_foundation') . '/js/behavior/reveal.js');
  581. }
  582. }
  583. /**
  584. * Implements hook_css_alter()
  585. */
  586. function zurb_foundation_css_alter(&$css) {
  587. // Remove defaults.css file.
  588. unset($css[drupal_get_path('module', 'system') . '/system.menus.css']);
  589. // Remove Drupal core CSS.
  590. if (theme_get_setting('zurb_foundation_disable_core_css')) {
  591. foreach($css as $path => $values) {
  592. if(strpos($path, 'modules/') === 0) {
  593. unset($css[$path]);
  594. }
  595. }
  596. }
  597. }
  598. /**
  599. * Replace Drupal pagers with Foundation pagers.
  600. */
  601. function zurb_foundation_pager($variables) {
  602. $tags = $variables['tags'];
  603. $element = $variables['element'];
  604. $parameters = $variables['parameters'];
  605. $quantity = $variables['quantity'];
  606. global $pager_page_array, $pager_total;
  607. // Calculate various markers within this pager piece:
  608. // Middle is used to "center" pages around the current page.
  609. $pager_middle = ceil($quantity / 2);
  610. // Current is the page we are currently paged to.
  611. $pager_current = $pager_page_array[$element] + 1;
  612. // First is the first page listed by this pager piece (re-quantify).
  613. $pager_first = $pager_current - $pager_middle + 1;
  614. // Last is the last page listed by this pager piece (re-quantify)
  615. $pager_last = $pager_current + $quantity - $pager_middle;
  616. // Max is the maximum page number.
  617. $pager_max = $pager_total[$element];
  618. // End of marker calculations.
  619. // Prepare for generation loop.
  620. $i = $pager_first;
  621. if ($pager_last > $pager_max) {
  622. // Adjust "center" if at end of query.
  623. $i = $i + ($pager_max - $pager_last);
  624. $pager_last = $pager_max;
  625. }
  626. if ($i <= 0) {
  627. // Adjust "center" if at start of query.
  628. $pager_last = $pager_last + (1 - $i);
  629. $i = 1;
  630. }
  631. // End of generation loop preparation.
  632. $li_first = theme('pager_first', array('text' => (isset($tags[0]) ? $tags[0] : t('« first')), 'element' => $element, 'parameters' => $parameters));
  633. $li_previous = theme('pager_previous', array('text' => (isset($tags[1]) ? $tags[1] : t('‹ previous')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  634. $li_next = theme('pager_next', array('text' => (isset($tags[3]) ? $tags[3] : t('next ›')), 'element' => $element, 'interval' => 1, 'parameters' => $parameters));
  635. $li_last = theme('pager_last', array('text' => (isset($tags[4]) ? $tags[4] : t('last »')), 'element' => $element, 'parameters' => $parameters));
  636. if ($pager_total[$element] > 1) {
  637. if ($li_first) {
  638. $items[] = array(
  639. 'class' => array('arrow'),
  640. 'data' => $li_first,
  641. );
  642. }
  643. if ($li_previous) {
  644. $items[] = array(
  645. 'class' => array('arrow'),
  646. 'data' => $li_previous,
  647. );
  648. }
  649. // When there is more than one page, create the pager list.
  650. if ($i != $pager_max) {
  651. if ($i > 1) {
  652. $items[] = array(
  653. 'class' => array('unavailable'),
  654. 'data' => '<a href="">&hellip;</a>',
  655. );
  656. }
  657. // Now generate the actual pager piece.
  658. for (; $i <= $pager_last && $i <= $pager_max; $i++) {
  659. if ($i < $pager_current) {
  660. $items[] = array(
  661. 'data' => theme('pager_previous', array('text' => $i, 'element' => $element, 'interval' => ($pager_current - $i), 'parameters' => $parameters)),
  662. );
  663. }
  664. if ($i == $pager_current) {
  665. $items[] = array(
  666. 'class' => array('current'),
  667. 'data' => '<a href="">' . $i . '</a>',
  668. );
  669. }
  670. if ($i > $pager_current) {
  671. $items[] = array(
  672. 'data' => theme('pager_next', array('text' => $i, 'element' => $element, 'interval' => ($i - $pager_current), 'parameters' => $parameters)),
  673. );
  674. }
  675. }
  676. if ($i < $pager_max) {
  677. $items[] = array(
  678. 'class' => array('unavailable'),
  679. 'data' => '<a href="">&hellip;</a>',
  680. );
  681. }
  682. }
  683. // End generation.
  684. if ($li_next) {
  685. $items[] = array(
  686. 'class' => array('arrow'),
  687. 'data' => $li_next,
  688. );
  689. }
  690. if ($li_last) {
  691. $items[] = array(
  692. 'class' => array('arrow'),
  693. 'data' => $li_last,
  694. );
  695. }
  696. $pager_links = array(
  697. '#theme' => 'item_list',
  698. '#items' => $items,
  699. '#attributes' => array('class' => array('pagination', 'pager')),
  700. );
  701. if (theme_get_setting('zurb_foundation_pager_center')) {
  702. $pager_links['#prefix'] = '<div class="pagination-centered">';
  703. $pager_links['#suffix'] = '</div>';
  704. }
  705. $pager_links = drupal_render($pager_links);
  706. return '<h2 class="element-invisible">' . t('Pages') . '</h2>' . $pager_links;
  707. }
  708. }
  709. /**
  710. * Implements hook_theme().
  711. */
  712. function zurb_foundation_theme() {
  713. $return = array();
  714. $return['zurb_foundation_reveal'] = array(
  715. 'variables' => array(
  716. // The text to display in the link.
  717. 'text' => '',
  718. // Whether the text uses HTML.
  719. 'html' => FALSE,
  720. // Whether the reveal uses AJAX content.
  721. // This can either be set to true, to use the link's href property or be
  722. // a URL to load the content from. Note that setting this parameter will
  723. // override the contents of the "reveal" variable.
  724. 'ajax' => FALSE,
  725. // The path for the link's href property. This is only really useful if
  726. // you want to set 'ajax' to TRUE (see above).
  727. 'path' => FALSE,
  728. // The content for the reveal modal. Can be either a string or a render
  729. // array.
  730. 'reveal' => '',
  731. // Extra classes to add to the link.
  732. 'link_classes_array' => array('zurb-foundation-reveal'),
  733. // Extra classes to add to the reveal modal.
  734. 'reveal_classes_array' => array('expand'),
  735. ),
  736. 'function' => 'theme_zurb_foundation_reveal',
  737. );
  738. $return['zurb_foundation_menu_link'] = array(
  739. 'variables' => array('link' => NULL),
  740. 'function' => 'theme_zurb_foundation_menu_link',
  741. );
  742. return $return;
  743. }
  744. /**
  745. * Helper function to store and return markup for reveal modals on the page.
  746. * This is necessary because we need to add all of the reveals to the bottom of
  747. * the page to avoid unexpected behavior. For more information please refer to
  748. * the official Zurb Foundation documentation.
  749. *
  750. * @param array
  751. * A render array for a reveal modal to store.
  752. * @return array
  753. * An array of all reveal render arrays.
  754. *
  755. * @see theme_zurb_foundation_reveal()
  756. */
  757. function _zurb_foundation_reveal($reveal = NULL) {
  758. $reveals = &drupal_static(__FUNCTION__);
  759. if (!isset($reveals)) {
  760. $reveals = array();
  761. }
  762. if (isset($reveal)) {
  763. $reveals[] = $reveal;
  764. }
  765. return $reveals;
  766. }
  767. /**
  768. * Theme function to create Zurb Foundation reveal modals.
  769. *
  770. * @see zurb_foundation_theme()
  771. * @see zurb_foundation_preprocess_region()
  772. * @see _zurb_foundation_reveal()
  773. */
  774. function theme_zurb_foundation_reveal($variables) {
  775. // Generate unique IDs.
  776. static $counter = 0;
  777. // Prepare reveal markup.
  778. $reveal_id = 'zf-reveal-' . ++$counter;
  779. $variables['reveal_classes_array'][] = 'reveal-modal';
  780. $reveal_classes = implode(' ', $variables['reveal_classes_array']);
  781. // Render reveal contents if applicable.
  782. if (is_array($variables['reveal'])) {
  783. $variables['reveal'] = drupal_render($variables['reveal']);
  784. }
  785. $reveal = array(
  786. '#markup' => $variables['reveal'],
  787. '#prefix' => '<div id="' . $reveal_id . '" class="' . $reveal_classes . '">',
  788. '#suffix' => '<a class="close-reveal-modal">&#215;</a></div>',
  789. );
  790. // Add reveal markup to static storage.
  791. _zurb_foundation_reveal($reveal);
  792. $build = array(
  793. '#theme' => 'link',
  794. '#text' => $variables['text'],
  795. '#path' => $variables['path'] ? $variables['path'] : 'javascript:',
  796. '#options' => array(
  797. 'attributes' => array(
  798. 'id' => 'zf-reveal-link-' . $counter,
  799. 'class' => $variables['link_classes_array'],
  800. 'data-reveal-id' => $reveal_id,
  801. ),
  802. 'html' => $variables['html'],
  803. 'external' => TRUE,
  804. ),
  805. );
  806. // Check for AJAX.
  807. if ($variables['ajax']) {
  808. if ($variables['ajax'] === TRUE) {
  809. $variables['ajax'] = 'true';
  810. }
  811. $build['#options']['attributes']['data-reveal-ajax'] = $variables['ajax'];
  812. }
  813. return drupal_render($build);
  814. }
  815. /**
  816. * Add the reveal modal markup (if any) to the page_bottom region.
  817. */
  818. function _zurb_foundation_add_reveals() {
  819. $markup = '';
  820. // Retrieve reveal markup from static storage.
  821. foreach (_zurb_foundation_reveal() as $reveal) {
  822. $markup .= "\n" . drupal_render($reveal);
  823. }
  824. return $markup;
  825. }
  826. /**
  827. * Implements hook_theme_registry_alter().
  828. */
  829. function zurb_foundation_theme_registry_alter(&$theme_registry) {
  830. // Add our own preprocess function to entities so we can add default classes
  831. // to our custom Display Suite layouts.
  832. $entity_info = entity_get_info();
  833. foreach ($entity_info as $entity => $info) {
  834. if (isset($entity_info[$entity]['fieldable']) && $entity_info[$entity]['fieldable']) {
  835. // User uses user_profile for theming.
  836. if ($entity == 'user') $entity = 'user_profile';
  837. // Only add preprocess functions if entity exposes theme function.
  838. if (isset($theme_registry[$entity])) {
  839. $theme_registry[$entity]['preprocess functions'][] = 'zurb_foundation_entity_variables';
  840. }
  841. }
  842. }
  843. // Support for File Entity.
  844. if (isset($theme_registry['file_entity'])) {
  845. $theme_registry['file_entity']['preprocess functions'][] = 'zurb_foundation_entity_variables';
  846. }
  847. // Support for Entity API.
  848. if (isset($theme_registry['entity'])) {
  849. $theme_registry['entity']['preprocess functions'][] = 'zurb_foundation_entity_variables';
  850. }
  851. }
  852. /**
  853. * Add default classes to Display Suite regions if none are set.
  854. *
  855. * This approach was taken from Display Suite.
  856. *
  857. * @see zurb_foundation_theme_registry_alter()
  858. */
  859. function zurb_foundation_entity_variables(&$vars) {
  860. // Only alter entities that have been rendered by Display Suite.
  861. if (isset($vars['rendered_by_ds'])) {
  862. // If Display Suite rendered this, it's safe to assume we have the arguments
  863. // necessary to grab the layout.
  864. $layout = ds_get_layout($vars['elements']['#entity_type'], $vars['elements']['#bundle'], $vars['elements']['#view_mode']);
  865. // Each layout has different regions, only set default classes if none of
  866. // them have custom classes.
  867. switch ($layout['layout']) {
  868. case 'zf_1col':
  869. if (empty($vars['ds_content_classes'])) {
  870. $vars['ds_content_classes'] = ' large-12';
  871. $vars['classes_array'][] = 'row';
  872. }
  873. break;
  874. case 'zf_2col':
  875. if (empty($vars['left_classes']) && empty($vars['right_classes'])) {
  876. $vars['left_classes'] = ' large-6';
  877. $vars['right_classes'] = ' large-6';
  878. $vars['classes_array'][] = 'row';
  879. }
  880. break;
  881. case 'zf_2col_stacked':
  882. if (
  883. empty($vars['header_classes']) && empty($vars['left_classes'])
  884. && empty($vars['right_classes']) && empty($vars['footer_classes'])
  885. ) {
  886. $vars['header_classes'] = ' large-12';
  887. $vars['left_classes'] = ' large-6';
  888. $vars['right_classes'] = ' large-6';
  889. $vars['footer_classes'] = ' large-12';
  890. $vars['classes_array'][] = 'row';
  891. }
  892. break;
  893. case 'zf_2col_bricks':
  894. if (empty($vars['top_classes']) && empty($vars['above_left_classes'])
  895. && empty($vars['above_right_classes']) && empty($vars['middle_classes'])
  896. && empty($vars['below_left_classes']) && empty($vars['below_right_classes'])
  897. && empty($vars['bottom_classes'])
  898. ) {
  899. $vars['top_classes'] = ' large-12';
  900. $vars['above_left_classes'] = ' large-6';
  901. $vars['above_right_classes'] = ' large-6';
  902. $vars['middle_classes'] = ' large-12';
  903. $vars['below_left_classes'] = ' large-6';
  904. $vars['below_right_classes'] = ' large-6';
  905. $vars['bottom_classes'] = ' large-12';
  906. $vars['classes_array'][] = 'row';
  907. }
  908. break;
  909. case 'zf_3col':
  910. if (empty($vars['left_classes']) && empty($vars['middle_classes'])
  911. && empty($vars['right_classes'])
  912. ) {
  913. $vars['left_classes'] = ' large-4';
  914. $vars['middle_classes'] = ' large-4';
  915. $vars['right_classes'] = ' large-4';
  916. $vars['classes_array'][] = 'row';
  917. }
  918. break;
  919. case 'zf_3col_stacked':
  920. if (
  921. empty($vars['header_classes']) && empty($vars['left_classes'])
  922. && empty($vars['middle_classes']) && empty($vars['right_classes'])
  923. && empty($vars['footer_classes'])
  924. ) {
  925. $vars['header_classes'] = ' large-12';
  926. $vars['left_classes'] = ' large-4';
  927. $vars['middle_classes'] = ' large-4';
  928. $vars['right_classes'] = ' large-4';
  929. $vars['footer_classes'] = ' large-12';
  930. $vars['classes_array'][] = 'row';
  931. }
  932. break;
  933. case 'zf_3col_bricks':
  934. if (empty($vars['top_classes']) && empty($vars['above_left_classes'])
  935. && empty($vars['above_middle_classes']) && empty($vars['above_right_classes'])
  936. && empty($vars['middle_classes']) && empty($vars['below_left_classes'])
  937. && empty($vars['below_middle_classes']) && empty($vars['below_right_classes'])
  938. && empty($vars['bottom_classes'])
  939. ) {
  940. $vars['top_classes'] = ' large-12';
  941. $vars['above_left_classes'] = ' large-4';
  942. $vars['above_middle_classes'] = ' large-4';
  943. $vars['above_right_classes'] = ' large-4';
  944. $vars['middle_classes'] = ' large-12';
  945. $vars['below_left_classes'] = ' large-4';
  946. $vars['below_middle_classes'] = ' large-4';
  947. $vars['below_right_classes'] = ' large-4';
  948. $vars['bottom_classes'] = ' large-12';
  949. $vars['classes_array'][] = 'row';
  950. }
  951. break;
  952. case 'zf_3row':
  953. if (empty($vars['header_classes']) && empty($vars['ds_content_classes'])
  954. && empty($vars['footer_classes'])
  955. ) {
  956. $vars['header_classes'] = ' large-12';
  957. $vars['ds_content_classes'] = ' large-12';
  958. $vars['footer_classes'] = ' large-12';
  959. $vars['classes_array'][] = 'row';
  960. }
  961. break;
  962. case 'zf_4col':
  963. if (empty($vars['first_classes']) && empty($vars['second_classes'])
  964. && empty($vars['third_classes']) && empty($vars['fourth_classes'])
  965. ) {
  966. $vars['first_classes'] = ' large-3';
  967. $vars['second_classes'] = ' large-3';
  968. $vars['third_classes'] = ' large-3';
  969. $vars['fourth_classes'] = ' large-3';
  970. $vars['classes_array'][] = 'row';
  971. }
  972. break;
  973. case 'zf_4col_stacked':
  974. if (
  975. empty($vars['header_classes']) && empty($vars['first_classes'])
  976. && empty($vars['second_classes']) && empty($vars['third_classes'])
  977. && empty($vars['fourth_classes']) && empty($vars['footer_classes'])
  978. ) {
  979. $vars['header_classes'] = ' large-12';
  980. $vars['first_classes'] = ' large-3';
  981. $vars['second_classes'] = ' large-3';
  982. $vars['third_classes'] = ' large-3';
  983. $vars['fourth_classes'] = ' large-3';
  984. $vars['footer_classes'] = ' large-12';
  985. $vars['classes_array'][] = 'row';
  986. }
  987. break;
  988. case 'zf_4col_bricks':
  989. if (empty($vars['top_classes']) && empty($vars['above_first_classes'])
  990. && empty($vars['above_second_classes']) && empty($vars['above_third_classes'])
  991. && empty($vars['above_fourth_classes']) && empty($vars['middle_classes'])
  992. && empty($vars['below_first_classes']) && empty($vars['below_second_classes'])
  993. && empty($vars['below_third_classes']) && empty($vars['below_fourth_classes'])
  994. && empty($vars['bottom_classes'])
  995. ) {
  996. $vars['top_classes'] = ' large-12';
  997. $vars['above_first_classes'] = ' large-3';
  998. $vars['above_second_classes'] = ' large-3';
  999. $vars['above_third_classes'] = ' large-3';
  1000. $vars['above_fourth_classes'] = ' large-3';
  1001. $vars['middle_classes'] = ' large-12';
  1002. $vars['below_first_classes'] = ' large-3';
  1003. $vars['below_second_classes'] = ' large-3';
  1004. $vars['below_third_classes'] = ' large-3';
  1005. $vars['below_fourth_classes'] = ' large-3';
  1006. $vars['bottom_classes'] = ' large-12';
  1007. $vars['classes_array'][] = 'row';
  1008. }
  1009. break;
  1010. }
  1011. }
  1012. }
  1013. /**
  1014. * Implements hook_process_html_tag()
  1015. *
  1016. * Prunes HTML tags: http://sonspring.com/journal/html5-in-drupal-7#_pruning
  1017. */
  1018. function zurb_foundation_process_html_tag(&$vars) {
  1019. if (theme_get_setting('zurb_foundation_html_tags')) {
  1020. $el = &$vars['element'];
  1021. // Remove type="..." and CDATA prefix/suffix.
  1022. unset($el['#attributes']['type'], $el['#value_prefix'], $el['#value_suffix']);
  1023. // Remove media="all" but leave others unaffected.
  1024. if (isset($el['#attributes']['media']) && $el['#attributes']['media'] === 'all') {
  1025. unset($el['#attributes']['media']);
  1026. }
  1027. }
  1028. }
  1029. /**
  1030. * Helper function to output a single link as button or multiple links as dropdown/split buttons.
  1031. *
  1032. * @param $variables
  1033. * @return string
  1034. */
  1035. function zurb_foundation_links__magic_button($variables) {
  1036. if (empty($variables['attributes']['class'])) {
  1037. $variables['attributes']['class'] = array();
  1038. }
  1039. if (count($variables['links']) > 1) {
  1040. switch ($variables['type']) {
  1041. case 'split':
  1042. return zurb_foundation_links__split_button($variables);
  1043. break;
  1044. case 'dropdown':
  1045. default:
  1046. return zurb_foundation_links__dropdown_button($variables);
  1047. break;
  1048. }
  1049. }
  1050. $links = $variables['links'];
  1051. $link = array_shift($links);
  1052. if (!isset($link['#localized_options']['attributes'])) {
  1053. $link['#localized_options']['attributes'] = array();
  1054. }
  1055. $link['#localized_options']['attributes'] = array_merge_recursive($link['#localized_options']['attributes'], $variables['attributes']);
  1056. $link['#localized_options']['attributes']['class'][] = 'button';
  1057. return l($link['#title'], $link['#href'], $link['#localized_options']);
  1058. }
  1059. /**
  1060. * Implements theme_links() with foundations dropdown button markup.
  1061. *
  1062. * @param $variables
  1063. * An associative array containing:
  1064. * - label
  1065. * - Dropdown button label.
  1066. * - links
  1067. * - An array of menu links.
  1068. * - attributes (optional)
  1069. * - class: Array of additional classes like large, alert, round
  1070. * - data-dropdown: Custom dropdown id.
  1071. *
  1072. * @return string
  1073. *
  1074. * Formats links for Dropdown Button http://foundation.zurb.com/docs/components/dropdown-buttons.html
  1075. */
  1076. function zurb_foundation_links__dropdown_button($variables) {
  1077. if (empty($variables['attributes']['class'])) {
  1078. $variables['attributes']['class'] = array();
  1079. }
  1080. $variables['attributes']['class'][] = 'button';
  1081. $variables['attributes']['class'][] = 'dropdown';
  1082. if (!isset($variables['attributes']['data-dropdown'])) {
  1083. $variables['attributes']['data-dropdown'] = drupal_html_id('ddb');
  1084. }
  1085. if (!isset($variables['label'])) {
  1086. $variables['label'] = t('Dropdown button');
  1087. }
  1088. $title = '<a href="#"' . drupal_attributes($variables['attributes']) .'>' . $variables['label'] . '</a>';
  1089. $output = _zurb_foundation_links($variables['links']);
  1090. return $title . '<ul id="' . $variables['attributes']['data-dropdown'] . '" class="f-dropdown" data-dropdown-content>' . $output . '</ul>';
  1091. }
  1092. /**
  1093. * Implements theme_links() with foundations split button markup.
  1094. *
  1095. * @param $variables
  1096. * An associative array containing:
  1097. * - links
  1098. * - An array of menu links.
  1099. * - attributes (optional)
  1100. * - class: Array of additional classes like large, alert, round
  1101. * - data-dropdown: Custom dropdown id.
  1102. *
  1103. * @return string
  1104. *
  1105. * Formats links for Split Button http://foundation.zurb.com/docs/components/split-buttons.html
  1106. */
  1107. function zurb_foundation_links__split_button($variables) {
  1108. $links = $variables['links'];
  1109. if (empty($variables['attributes']['class'])) {
  1110. $variables['attributes']['class'] = array();
  1111. }
  1112. $variables['attributes']['class'][] = 'button';
  1113. if (!isset($variables['attributes']['data-dropdown'])) {
  1114. $variables['attributes']['data-dropdown'] = drupal_html_id('ddb');
  1115. }
  1116. $id = $variables['attributes']['data-dropdown'];
  1117. unset($variables['attributes']['data-dropdown']);
  1118. if (!isset($variables['label'])) {
  1119. $variables['label'] = t('Split button');
  1120. }
  1121. $primary_link = array();
  1122. $primary_link['#title'] = $variables['label'] . '<span data-dropdown="' . $id . '"></span>';
  1123. $primary_link['#localized_options']['attributes']['class'][] = 'split';
  1124. $primary_link['#localized_options']['html'] = TRUE;
  1125. $primary_link['#localized_options']['fragment'] = $id;
  1126. $primary_link['#localized_options']['attributes'] = array_merge_recursive($primary_link['#localized_options']['attributes'], $variables['attributes']);
  1127. $primary_link = l($primary_link['#title'], '', $primary_link['#localized_options']);
  1128. $output = _zurb_foundation_links($links);
  1129. return $primary_link . '<ul id="' . $id . '" class="f-dropdown" data-dropdown-content>' . $output . '</ul>';
  1130. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.