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
alpha_alpha_page_structure_alter Implements hook_alpha_page_alter().
alpha_alpha_preprocess_block Implements hook_preprocess_block().
alpha_alpha_preprocess_html Implements hook_preprocess_html().
alpha_alpha_preprocess_page Implements hook_preprocess_page().
alpha_alpha_preprocess_region Implements hook_preprocess_region().
alpha_alpha_process_page Implements hook_process_page().
alpha_css_alter Implements hook_css_alter().
alpha_element_info_alter Implements hook_element_info_alter().
alpha_page_alter Implements hook_page_alter().
alpha_preprocess Implements hook_preprocess().
alpha_process Implements hook_process().
alpha_theme Implements hook_theme().
template_preprocess_section Implements hook_preprocess_section().
template_preprocess_zone Implements hook_preprocess_zone().

File

sites/all/themes/ulmus/omega/alpha/template.php
View source
  1. <?php
  2. require_once dirname(__FILE__) . '/includes/alpha.inc';
  3. require_once dirname(__FILE__) . '/includes/base.inc';
  4. /**
  5. * Implements hook_theme().
  6. */
  7. function alpha_theme($existing, $type, $theme, $path) {
  8. return array(
  9. 'section' => array(
  10. 'template' => 'section',
  11. 'path' => $path . '/templates',
  12. 'render element' => 'elements',
  13. 'pattern' => 'section__',
  14. 'preprocess functions' => array(
  15. 'template_preprocess',
  16. 'template_preprocess_section',
  17. 'alpha_preprocess',
  18. 'alpha_preprocess_section',
  19. ),
  20. 'process functions' => array(
  21. 'template_process',
  22. 'template_process_section',
  23. 'alpha_process',
  24. 'alpha_process_section'
  25. ),
  26. ),
  27. 'zone' => array(
  28. 'template' => 'zone',
  29. 'path' => $path . '/templates',
  30. 'render element' => 'elements',
  31. 'pattern' => 'zone__',
  32. 'preprocess functions' => array(
  33. 'template_preprocess',
  34. 'template_preprocess_zone',
  35. 'alpha_preprocess',
  36. 'alpha_preprocess_zone',
  37. ),
  38. 'process functions' => array(
  39. 'template_process',
  40. 'template_process_zone',
  41. 'alpha_process',
  42. 'alpha_process_zone'
  43. ),
  44. ),
  45. );
  46. }
  47. /**
  48. * Implements hook_preprocess().
  49. */
  50. function alpha_preprocess(&$vars, $hook) {
  51. $vars['attributes_array']['class'] = $vars['classes_array'];
  52. alpha_invoke('preprocess', $hook, $vars);
  53. }
  54. /**
  55. * Implements hook_process().
  56. */
  57. function alpha_process(&$vars, $hook) {
  58. if (!empty($vars['elements']['#grid']) || !empty($vars['elements']['#data']['wrapper_css'])) {
  59. if (!empty($vars['elements']['#grid'])) {
  60. foreach (array('prefix', 'suffix', 'push', 'pull') as $quality) {
  61. if (!empty($vars['elements']['#grid'][$quality])) {
  62. array_unshift($vars['attributes_array']['class'], $quality . '-' . $vars['elements']['#grid'][$quality]);
  63. }
  64. }
  65. array_unshift($vars['attributes_array']['class'], 'grid-' . $vars['elements']['#grid']['columns']);
  66. }
  67. if (!empty($vars['elements']['#data']['wrapper_css'])) {
  68. foreach (array_map('drupal_html_class', explode(' ', $vars['elements']['#data']['wrapper_css'])) as $class) {
  69. $vars['attributes_array']['class'][] = $class;
  70. }
  71. }
  72. $vars['attributes'] = $vars['attributes_array'] ? drupal_attributes($vars['attributes_array']) : '';
  73. }
  74. if (!empty($vars['elements']['#grid_container']) || !empty($vars['elements']['#data']['css'])) {
  75. if (!empty($vars['elements']['#data']['css'])) {
  76. foreach (array_map('drupal_html_class', explode(' ', $vars['elements']['#data']['css'])) as $class) {
  77. $vars['content_attributes_array']['class'][] = $class;
  78. }
  79. }
  80. if (!empty($vars['elements']['#grid_container'])) {
  81. $vars['content_attributes_array']['class'][] = 'container-' . $vars['elements']['#grid_container'];
  82. }
  83. $vars['content_attributes'] = $vars['content_attributes_array'] ? drupal_attributes($vars['content_attributes_array']) : '';
  84. }
  85. alpha_invoke('process', $hook, $vars);
  86. }
  87. /**
  88. * Implements hook_element_info_alter().
  89. */
  90. function alpha_element_info_alter(&$elements) {
  91. if (variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')) {
  92. array_unshift($elements['styles']['#pre_render'], 'alpha_css_preprocessor');
  93. }
  94. }
  95. /**
  96. * Implements hook_css_alter().
  97. */
  98. function alpha_css_alter(&$css) {
  99. global $language;
  100. $theme = alpha_get_theme();
  101. if ($theme->settings['exclude']) {
  102. if ($exclude = array_filter($theme->settings['exclude'])) {
  103. if ($language->direction == LANGUAGE_LTR) {
  104. foreach ($exclude as $basename) {
  105. $rtl = str_replace('.css', '-rtl.css', $basename);
  106. $exclude[$rtl] = $rtl;
  107. }
  108. }
  109. foreach($css as $key => $item) {
  110. if (isset($exclude[$key])) {
  111. unset($css[$key]);
  112. }
  113. }
  114. }
  115. }
  116. }
  117. /**
  118. * Implements hook_page_alter().
  119. */
  120. function alpha_page_alter(&$vars) {
  121. $theme = alpha_get_theme();
  122. $theme->settings['debug']['access'] = alpha_debug_access($GLOBALS['user'], $theme->settings['debug']['roles']);
  123. // If no module has taken care of the main content, add it to the page now.
  124. // This allows the site to still be usable even if no modules that
  125. // control page regions (for example, the Block module) are enabled.
  126. if (!drupal_static('system_main_content_added', FALSE)) {
  127. $vars['content']['system_main'] = drupal_set_page_content();
  128. }
  129. if (($theme->settings['debug']['access'] || $GLOBALS['user']->uid == 1) && ($theme->settings['debug']['grid'] || $theme->settings['debug']['block'])) {
  130. drupal_add_css(drupal_get_path('theme', 'alpha') . '/css/alpha-debug.css', array('group' => CSS_THEME, 'weight' => -5));
  131. drupal_add_js(drupal_get_path('theme', 'alpha') . '/js/alpha-debug.js', array('group' => JS_THEME, 'weight' => -5));
  132. if ($theme->settings['responsive']) {
  133. $vars['page_bottom']['alpha_resize_indicator'] = array(
  134. '#type' => 'markup',
  135. '#markup' => '<div class="alpha-resize-indicator"></div>',
  136. );
  137. }
  138. if ($theme->settings['debug']['grid']) {
  139. $vars['page_bottom']['alpha_grid_toggle'] = array(
  140. '#type' => 'markup',
  141. '#markup' => '<a class="alpha-grid-toggle" href="#"></a>',
  142. );
  143. }
  144. if ($theme->settings['debug']['block']) {
  145. $vars['page_bottom']['alpha_block_toggle'] = array(
  146. '#type' => 'markup',
  147. '#markup' => '<a class="alpha-block-toggle" href="#"></a>',
  148. );
  149. foreach ($theme->regions as $region => $item) {
  150. if ($item['enabled']) {
  151. if (empty($vars[$region])) {
  152. $vars[$region]['#region'] = $region;
  153. $vars[$region]['#theme_wrappers'] = array('region');
  154. }
  155. if (isset($vars[$region]['#theme_wrappers']) && array_search('region', $vars[$region]['#theme_wrappers']) !== FALSE) {
  156. $vars[$region] = array('alpha_debug_' . $region => array(
  157. '#type' => 'markup',
  158. '#markup' => '<div class="alpha-debug-block"><h2>' . $item['name'] . '</h2><p>' . t('This is a debugging block') . '</p></div>',
  159. '#weight' => -999,
  160. )) + $vars[$region];
  161. }
  162. }
  163. }
  164. }
  165. }
  166. if (!module_implements('alpha_page_structure_alter')) {
  167. alpha_alter('alpha_page_structure', $vars, $theme->theme);
  168. }
  169. else {
  170. drupal_alter('alpha_page_structure', $vars, $theme->theme);
  171. }
  172. }
  173. /**
  174. * Implements hook_alpha_page_alter().
  175. */
  176. function alpha_alpha_page_structure_alter(&$vars) {
  177. $theme = alpha_get_theme();
  178. $temporary = array();
  179. foreach ($theme->regions as $region => $item) {
  180. if ($item['enabled'] && $theme->zones[$item['zone']]['enabled'] && ($item['force'] || !empty($vars[$region]))) {
  181. $temporary[$item['section']][$item['zone']][$region] = !empty($vars[$region]) ? $vars[$region] : array();
  182. $temporary[$item['section']][$item['zone']][$region]['#weight'] = (int) $item['weight'];
  183. $temporary[$item['section']][$item['zone']][$region]['#position'] = $item['position'];
  184. $temporary[$item['section']][$item['zone']][$region]['#data'] = $item;
  185. $temporary[$item['section']][$item['zone']][$region]['#grid'] = array(
  186. 'prefix' => $item['prefix'],
  187. 'suffix' => $item['suffix'],
  188. 'push' => $item['push'],
  189. 'pull' => $item['pull'],
  190. 'columns' => $item['columns'],
  191. );
  192. $theme->regions[$region]['grid'] = &$temporary[$item['section']][$item['zone']][$region]['#grid'];
  193. if (empty($vars[$region])) {
  194. $temporary[$item['section']][$item['zone']][$region]['#region'] = $region;
  195. $temporary[$item['section']][$item['zone']][$region]['#theme_wrappers'] = array('region');
  196. }
  197. }
  198. else if (!empty($vars[$region])) {
  199. $vars['#excluded'][$region] = !empty($vars[$region]) ? $vars[$region] : array();
  200. $vars['#excluded'][$region]['#weight'] = (int) $item['weight'];
  201. $vars['#excluded'][$region]['#data'] = $item;
  202. $vars['#excluded'][$region]['#grid'] = array(
  203. 'prefix' => $item['prefix'],
  204. 'suffix' => $item['suffix'],
  205. 'push' => $item['push'],
  206. 'pull' => $item['pull'],
  207. 'columns' => $item['columns'],
  208. );
  209. }
  210. unset($vars[$region]);
  211. }
  212. foreach ($theme->zones as $zone => $item) {
  213. if ($item['enabled'] && ($item['force'] || !empty($temporary[$item['section']][$zone]))) {
  214. if (isset($item['primary']) && isset($temporary[$item['section']][$zone][$item['primary']])) {
  215. alpha_calculate_primary($temporary[$item['section']][$zone], $item['primary'], $item['columns']);
  216. }
  217. if ($item['order']) {
  218. alpha_calculate_position($temporary[$item['section']][$zone]);
  219. }
  220. $temporary[$item['section']][$zone]['#theme_wrappers'] = array('zone');
  221. $temporary[$item['section']][$zone]['#zone'] = $zone;
  222. $temporary[$item['section']][$zone]['#weight'] = (int) $item['weight'];
  223. $temporary[$item['section']][$zone]['#data'] = $item;
  224. $temporary[$item['section']][$zone]['#grid_container'] = $item['columns'];
  225. }
  226. }
  227. foreach ($theme->sections as $section => $item) {
  228. if (isset($temporary[$section])) {
  229. $temporary[$section]['#theme_wrappers'] = array('section');
  230. $temporary[$section]['#section'] = $section;
  231. }
  232. }
  233. $vars = array_merge($vars, $temporary);
  234. }
  235. /**
  236. * Implements hook_preprocess_section().
  237. */
  238. function template_preprocess_section(&$vars) {
  239. $vars['theme_hook_suggestions'][] = 'section__' . $vars['elements']['#section'];
  240. $vars['section'] = $vars['elements']['#section'];
  241. $vars['content'] = $vars['elements']['#children'];
  242. $vars['attributes_array']['id'] = drupal_html_id('section-' . $vars['section']);
  243. $vars['classes_array'] = array('section', $vars['attributes_array']['id']);
  244. }
  245. /**
  246. * Implements hook_preprocess_zone().
  247. */
  248. function template_preprocess_zone(&$vars) {
  249. $vars['theme_hook_suggestions'] = array('zone__' . $vars['elements']['#zone']);
  250. $vars['zone'] = $vars['elements']['#zone'];
  251. $vars['content'] = $vars['elements']['#children'];
  252. $vars['wrapper'] = $vars['elements']['#data']['wrapper'];
  253. $vars['columns'] = $vars['elements']['#data']['columns'];
  254. $vars['content_attributes_array']['id'] = drupal_html_id('zone-' . $vars['zone']);
  255. $vars['content_attributes_array']['class'] = array('zone', $vars['content_attributes_array']['id'], 'clearfix');
  256. if ($vars['wrapper']) {
  257. $vars['attributes_array']['id'] = drupal_html_id($vars['content_attributes_array']['id'] . '-wrapper');
  258. $vars['classes_array'] = array('zone-wrapper', $vars['attributes_array']['id'], 'clearfix');
  259. }
  260. alpha_grid_include($vars['columns']);
  261. }
  262. /**
  263. * Implements hook_preprocess_block().
  264. */
  265. function alpha_alpha_preprocess_block(&$vars) {
  266. $vars['content_attributes_array']['class'][] = 'content';
  267. $vars['content_attributes_array']['class'][] = 'clearfix';
  268. $vars['attributes_array']['id'] = $vars['block_html_id'];
  269. $vars['attributes_array']['class'][] = drupal_html_class('block-' . $vars['block']->delta);
  270. $vars['attributes_array']['class'][] = $vars['block_html_id'];
  271. }
  272. /**
  273. * Implements hook_preprocess_html().
  274. */
  275. function alpha_alpha_preprocess_html(&$vars) {
  276. $theme = alpha_get_theme();
  277. foreach (array('two-sidebars', 'one-sidebar sidebar-first', 'one-sidebar sidebar-second', 'no-sidebars') as $exclude) {
  278. if ($index = array_search($exclude, $vars['attributes_array']['class'])) {
  279. unset($vars['attributes_array']['class'][$index]);
  280. }
  281. }
  282. // Add a CSS class based on the current page context.
  283. if (!drupal_is_front_page()) {
  284. $context = explode('/', drupal_get_path_alias());
  285. $context = reset($context);
  286. if (!empty($context)) {
  287. $vars['attributes_array']['class'][] = drupal_html_class('context-' . $context);
  288. }
  289. }
  290. if (($theme->settings['debug']['grid'] || $theme->settings['debug']['block']) && $theme->settings['debug']['access']) {
  291. if ($theme->settings['debug']['grid'] && $theme->settings['debug']['grid_active']) {
  292. $vars['attributes_array']['class'][] = 'alpha-grid-debug';
  293. }
  294. if ($theme->settings['debug']['block'] && $theme->settings['debug']['block_active']) {
  295. $vars['attributes_array']['class'][] = 'alpha-region-debug';
  296. }
  297. }
  298. if($theme->settings['responsive'] && $theme->settings['viewport']['enabled']) {
  299. $meta = array(
  300. '#tag' => 'meta',
  301. '#attributes' => array(
  302. 'name' => 'viewport',
  303. 'content' => 'width=device-width, initial-scale=' . $theme->settings['viewport']['initial'] . ', maximum-scale=' . $theme->settings['viewport']['max'] . ', minimum-scale=' . $theme->settings['viewport']['min'] . ', user-scalable=' . ($theme->settings['viewport']['user'] ? 'yes' : 'no'),
  304. ),
  305. );
  306. drupal_add_html_head($meta, 'alpha-viewport');
  307. }
  308. alpha_css_include();
  309. alpha_libraries_include();
  310. }
  311. /**
  312. * Implements hook_preprocess_page().
  313. */
  314. function alpha_alpha_preprocess_page(&$vars) {
  315. $theme = alpha_get_theme();
  316. $theme->page = &$vars;
  317. $vars['feed_icons'] = $theme->settings['toggle']['feed_icons'] ? $vars['feed_icons'] : NULL;
  318. $vars['tabs'] = $theme->settings['toggle']['tabs'] ? $vars['tabs'] : NULL;
  319. $vars['action_links'] = $theme->settings['toggle']['action_links'] ? $vars['action_links'] : NULL;
  320. $vars['show_messages'] = $theme->settings['toggle']['messages'] ? $vars['show_messages'] : FALSE;
  321. $vars['site_name_hidden'] = $theme->settings['hidden']['site_name'];
  322. $vars['site_slogan_hidden'] = $theme->settings['hidden']['site_slogan'];
  323. $vars['title_hidden'] = $theme->settings['hidden']['title'];
  324. $vars['attributes_array']['id'] = 'page';
  325. $vars['attributes_array']['class'][] = 'clearfix';
  326. }
  327. /**
  328. * Implements hook_preprocess_region().
  329. */
  330. function alpha_alpha_preprocess_region(&$vars) {
  331. $vars['attributes_array']['id'] = drupal_html_id('region-' . $vars['region']);
  332. $vars['content_attributes_array']['class'][] = 'region-inner';
  333. $vars['content_attributes_array']['class'][] = $vars['attributes_array']['id'] . '-inner';
  334. }
  335. /**
  336. * Implements hook_process_page().
  337. */
  338. function alpha_alpha_process_page(&$vars) {
  339. $theme = alpha_get_theme();
  340. $vars['title'] = $theme->settings['toggle']['page_title'] ? $vars['title'] : NULL;
  341. $vars['breadcrumb'] = $theme->settings['toggle']['breadcrumb'] ? $vars['breadcrumb'] : NULL;
  342. }