theme.inc

  1. cis7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  2. cis7 sites/all/themes/local_contrib/zurb-foundation/inc/theme.inc
  3. cis7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  4. cis7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  5. cis7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  6. cis7 sites/all/modules/ulmus/features/theme/theme.inc
  7. cis7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  8. cis7 sites/all/modules/ulmus/views/theme/theme.inc
  9. cis7 sites/all/modules/local_contrib/views_fluid_grid/theme/theme.inc
  10. cis7 sites/all/themes/ulmus/aurora/includes/theme.inc
  11. cis7 includes/theme.inc
  12. cis7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  13. cle7 sites/all/themes/local_contrib/bootstrap/includes/theme.inc
  14. cle7 sites/all/themes/ulmus/aurora/includes/theme.inc
  15. cle7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  16. cle7 sites/all/modules/ulmus/features/theme/theme.inc
  17. cle7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  18. cle7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  19. cle7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  20. cle7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  21. cle7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  22. cle7 sites/all/modules/ulmus/views/theme/theme.inc
  23. cle7 includes/theme.inc
  24. cle7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  25. cle7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  26. ecd7 sites/all/modules/ulmus/features/theme/theme.inc
  27. ecd7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  28. ecd7 sites/all/themes/ulmus/aurora/includes/theme.inc
  29. ecd7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  30. ecd7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  31. ecd7 includes/theme.inc
  32. ecd7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  33. ecd7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  34. ecd7 sites/all/modules/ulmus/views/theme/theme.inc
  35. ecd7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  36. ecd7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  37. elmsmedia7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  38. elmsmedia7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  39. elmsmedia7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  40. elmsmedia7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  41. elmsmedia7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  42. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  43. elmsmedia7 sites/all/modules/ulmus/features/theme/theme.inc
  44. elmsmedia7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  45. elmsmedia7 sites/all/modules/local_contrib/views_fluid_grid/theme/theme.inc
  46. elmsmedia7 sites/all/themes/ulmus/aurora/includes/theme.inc
  47. elmsmedia7 includes/theme.inc
  48. elmsmedia7 sites/all/modules/ulmus/views/theme/theme.inc
  49. harmony7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  50. harmony7 sites/all/themes/ulmus/aurora/includes/theme.inc
  51. harmony7 sites/all/modules/local_contrib/harmony_core/theme/theme.inc
  52. harmony7 includes/theme.inc
  53. harmony7 sites/all/modules/ulmus/views/theme/theme.inc
  54. harmony7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  55. harmony7 sites/all/modules/ulmus/features/theme/theme.inc
  56. harmony7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  57. harmony7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  58. harmony7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  59. harmony7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  60. harmony7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  61. icor7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  62. icor7 sites/all/modules/ulmus/views/theme/theme.inc
  63. icor7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  64. icor7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  65. icor7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  66. icor7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  67. icor7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  68. icor7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  69. icor7 sites/all/themes/ulmus/aurora/includes/theme.inc
  70. icor7 includes/theme.inc
  71. icor7 sites/all/modules/ulmus/features/theme/theme.inc
  72. meedjum_blog7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  73. meedjum_blog7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  74. meedjum_blog7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  75. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  76. meedjum_blog7 sites/all/modules/ulmus/features/theme/theme.inc
  77. meedjum_blog7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  78. meedjum_blog7 sites/all/themes/ulmus/aurora/includes/theme.inc
  79. meedjum_blog7 sites/all/modules/ulmus/views/theme/theme.inc
  80. meedjum_blog7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  81. meedjum_blog7 includes/theme.inc
  82. meedjum_blog7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  83. mooc7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  84. mooc7 includes/theme.inc
  85. mooc7 sites/all/themes/ulmus/aurora/includes/theme.inc
  86. mooc7 sites/all/modules/ulmus/views/theme/theme.inc
  87. mooc7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  88. mooc7 sites/all/modules/ulmus/features/theme/theme.inc
  89. mooc7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  90. mooc7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  91. mooc7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  92. mooc7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  93. mooc7 sites/all/modules/ulmus/date/date_views/theme/theme.inc

Custom theme functions and theme function overrides.

If you need to add or modify theme functions do it in your sub-theme.

Functions

Namesort descending Description
adaptivetheme_breadcrumb Returns HTML for a breadcrumb trail.
adaptivetheme_field Returns HTML for a field.
adaptivetheme_field__image Returns HTML for an image field.
adaptivetheme_field__taxonomy_term_reference Returns HTML for a taxonomy field.
adaptivetheme_item_list Returns HTML for a list or nested list of items.
adaptivetheme_links Returns HTML for a set of links.
adaptivetheme_menubar Returns HTML for a menubar.
adaptivetheme_status_messages Returns HTML for status and/or error messages, grouped by type.
adaptivetheme_theme Implements hook_theme()
_theme_menu_variables Helper function for theming main and secondary variables. Provides 7.x-2.x backward compatibility, not used in 7.x-3.x, instead we now use a proper theme function so themers can override it.

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Custom theme functions and theme function overrides.
  5. *
  6. * If you need to add or modify theme functions do it in your sub-theme.
  7. */
  8. /**
  9. * Implements hook_theme()
  10. *
  11. * @param $existing
  12. * @param $type
  13. * @param $theme
  14. * @param $path
  15. *
  16. * @see http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_theme/7
  17. */
  18. function adaptivetheme_theme($existing, $type, $theme, $path) {
  19. return array(
  20. 'menubar' => array(
  21. 'render element' => 'element',
  22. ),
  23. );
  24. }
  25. /**
  26. * Returns HTML for a menubar.
  27. *
  28. * The contents is normally one of Drupals magic menu variables, such as the
  29. * Main menu or User menu (secondary menu), but could be any menu you wish to
  30. * wrap in navigation menu type markup and classes.
  31. *
  32. * @param $vars
  33. * An array containing:
  34. * - $menubar_id: CSS id for theming the menubar
  35. * - $menu: Holds the themed menu (normally using theme_links())
  36. * - the usual $classes, $attributes, $content attributes etc
  37. *
  38. * @see adaptivetheme_preprocess_menubar()
  39. * @see adaptivetheme_process_menubar()
  40. */
  41. function adaptivetheme_menubar($vars) {
  42. $output = '';
  43. $output .= '<div id="' . $vars['menubar_id'] . '" class="' . $vars['classes'] . '"' . $vars['attributes'] . '>';
  44. $output .= '<nav ' . $vars['content_attributes'] . '>';
  45. $output .= $vars['menu'];
  46. $output .= '</nav></div>';
  47. return $output;
  48. }
  49. /**
  50. * Helper function for theming main and secondary variables.
  51. * Provides 7.x-2.x backward compatibility, not used in 7.x-3.x, instead we now
  52. * use a proper theme function so themers can override it.
  53. *
  54. * @param $menu
  55. * @param $type
  56. */
  57. function _theme_menu_variables($menu, $type) {
  58. $output = '<div id="' . $type . '-menu-bar" class="nav"><nav class="clearfix">' . $menu . '</nav></div>';
  59. return $output;
  60. }
  61. /**
  62. * Returns HTML for a breadcrumb trail.
  63. *
  64. * Adaptivetheme renders breadcrumbs as an ordered list (<ol>...</ol>), wrapping
  65. * crumbs in li elements and the seperators in span elements. Additionally .crumb,
  66. * .crumb-first and .crumb-last classes are printed on the li elements. We also
  67. * remove some silly breadcrumbs from various pages.
  68. *
  69. * @param $vars
  70. * An associative array containing:
  71. * - breadcrumb: An array containing the breadcrumb links.
  72. */
  73. function adaptivetheme_breadcrumb($vars) {
  74. global $theme_key;
  75. $theme_name = $theme_key;
  76. $breadcrumb = $vars['breadcrumb'];
  77. if (at_get_setting('breadcrumb_display', $theme_name) == 1) {
  78. if (at_get_setting('breadcrumb_home', $theme_name) == 0) {
  79. array_shift($breadcrumb);
  80. }
  81. // Remove the rather pointless breadcrumbs for reset password and user
  82. // register pages, they link to the page you are on, doh!
  83. if (arg(0) === 'user' && (arg(1) === 'password' || arg(1) === 'register')) {
  84. array_pop($breadcrumb);
  85. }
  86. if (!empty($breadcrumb)) {
  87. $separator = filter_xss_admin(at_get_setting('breadcrumb_separator', $theme_name));
  88. // Push the page title onto the end of the breadcrumb array
  89. if (at_get_setting('breadcrumb_title', $theme_name) == 1) {
  90. if ($page_title = drupal_get_title()) {
  91. $breadcrumb[] = '<span class="crumb-title">' . $page_title . '</span>';
  92. }
  93. }
  94. $class = 'crumb';
  95. end($breadcrumb);
  96. $last = key($breadcrumb);
  97. $output = '';
  98. if (at_get_setting('breadcrumb_label', $theme_name) == 1) {
  99. $output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper with-breadcrumb-label clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
  100. $output .= '<h2 id="breadcrumb-label" class="breadcrumb-label">' . t('You are here') . '</h2>';
  101. }
  102. else {
  103. $output = '<div id="breadcrumb" class="clearfix"><nav class="breadcrumb-wrapper clearfix" role="navigation" aria-labelledby="breadcrumb-label">';
  104. $output .= '<h2 id="breadcrumb-label" class="element-invisible">' . t('You are here') . '</h2>';
  105. }
  106. $output .= '<ol id="crumbs" class="clearfix">';
  107. foreach ($breadcrumb as $key => $crumb) {
  108. if ($key == $last && count($breadcrumb) != 1) {
  109. $class = 'crumb crumb-last';
  110. }
  111. if ($key == 0) {
  112. $output .= '<li class="' . $class . ' crumb-first">' . $crumb . '</li>';
  113. }
  114. else {
  115. $output .= '<li class="' . $class . '"><span class="crumb-separator">' . $separator . '</span>' . $crumb . '</li>';
  116. }
  117. }
  118. $output .= '</ol></nav></div>';
  119. return $output;
  120. }
  121. }
  122. else {
  123. return;
  124. }
  125. }
  126. /**
  127. * Returns HTML for status and/or error messages, grouped by type.
  128. *
  129. * Adaptivetheme adds a div wrapper with CSS id.
  130. *
  131. * An invisible heading identifies the messages for assistive technology.
  132. * Sighted users see a colored box. See http://www.w3.org/TR/WCAG-TECHS/H69.html
  133. * for info.
  134. *
  135. * @param $vars
  136. * An associative array containing:
  137. * - display: (optional) Set to 'status' or 'error' to display only messages
  138. * of that type.
  139. */
  140. function adaptivetheme_status_messages($vars) {
  141. $display = drupal_get_messages($vars['display']);
  142. $output = '';
  143. if (count($display) > 0) {
  144. $status_heading = array(
  145. 'status' => t('Status message'),
  146. 'error' => t('Error message'),
  147. 'warning' => t('Warning message'),
  148. );
  149. foreach ($display as $type => $messages) {
  150. $output .= "<div class=\"messages $type\">";
  151. if (!empty($status_heading[$type])) {
  152. $output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>";
  153. }
  154. if (count($messages) > 1) {
  155. $output .= " <ul>";
  156. foreach ($messages as $message) {
  157. $output .= ' <li class="message-item">' . $message . "</li>";
  158. }
  159. $output .= " </ul>";
  160. }
  161. else {
  162. $output .= $messages[0];
  163. }
  164. $output .= "</div>";
  165. }
  166. if ($output != ''){
  167. $output = "<div id=\"messages\">" . $output . "</div>";
  168. }
  169. }
  170. return $output;
  171. }
  172. /**
  173. * Returns HTML for a list or nested list of items.
  174. *
  175. * Adaptivetheme overrides this in order to insert extra classes into list
  176. * items, including first, last and odd/even zebra classes.
  177. *
  178. * @param $vars
  179. * An associative array containing:
  180. * - items: An array of items to be displayed in the list. If an item is a
  181. * string, then it is used as is. If an item is an array, then the "data"
  182. * element of the array is used as the contents of the list item. If an item
  183. * is an array with a "children" element, those children are displayed in a
  184. * nested list. All other elements are treated as attributes of the list
  185. * item element.
  186. * - title: The title of the list.
  187. * - type: The type of list to return (e.g. "ul", "ol").
  188. * - attributes: The attributes applied to the list element.
  189. */
  190. function adaptivetheme_item_list($vars) {
  191. global $theme_key;
  192. $theme_name = $theme_key;
  193. $items = $vars['items'];
  194. $title = $vars['title'];
  195. $type = $vars['type'];
  196. $attributes = $vars['attributes'];
  197. // If a class exists use it on the wrapper, for Drupal core this mainly applies
  198. // to the pager, so you get the wrapper class .item-list-pager
  199. if (isset($attributes['class'])) {
  200. $output = '<div class="item-list item-list-' . $attributes['class'][0] . '">';
  201. }
  202. else {
  203. $output = '<div class="item-list">';
  204. }
  205. if (isset($title) && $title !== '') {
  206. $output .= '<h3>' . $title . '</h3>';
  207. }
  208. if (!empty($items)) {
  209. $output .= "<$type" . drupal_attributes($attributes) . '>';
  210. $num_items = count($items);
  211. foreach ($items as $i => $item) {
  212. $attributes = array();
  213. $children = array();
  214. $data = '';
  215. if (is_array($item)) {
  216. foreach ($item as $key => $value) {
  217. if ($key == 'data') {
  218. $data = $value;
  219. }
  220. elseif ($key == 'children') {
  221. $children = $value;
  222. }
  223. else {
  224. $attributes[$key] = $value;
  225. }
  226. }
  227. }
  228. else {
  229. $data = $item;
  230. }
  231. if (count($children) > 0) {
  232. // Render nested list.
  233. $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
  234. }
  235. if (at_get_setting('extra_item_list_classes', $theme_name) == 1) {
  236. if ($i & 1) {
  237. $attributes['class'][] = 'odd';
  238. }
  239. else {
  240. $attributes['class'][] = 'even';
  241. }
  242. if ($i == 0) {
  243. $attributes['class'][] = 'first';
  244. }
  245. if ($i == $num_items - 1) {
  246. $attributes['class'][] = 'last';
  247. }
  248. }
  249. $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>"; // no new line!
  250. }
  251. $output .= "</$type>";
  252. }
  253. $output .= '</div>';
  254. return $output;
  255. }
  256. // Dont run this if the DHTML module is running, it borks its output!
  257. if (!function_exists('dhtml_menu_init')) {
  258. /**
  259. * Returns HTML for a wrapper for a menu sub-tree.
  260. *
  261. * Adaptivetheme overrides this to insert the clearfix class.
  262. *
  263. * @param $vars
  264. * An associative array containing:
  265. * - tree: An HTML string containing the tree's items.
  266. *
  267. * @see template_preprocess_menu_tree()
  268. */
  269. function adaptivetheme_menu_tree($vars) {
  270. return '<ul class="menu clearfix">' . $vars['tree'] . '</ul>';
  271. }
  272. /**
  273. * Returns HTML for a menu link and submenu.
  274. *
  275. * Adaptivetheme overrides this to insert extra classes including a depth
  276. * class and a menu id class. It can also wrap menu items in span elements.
  277. *
  278. * @param $vars
  279. * An associative array containing:
  280. * - element: Structured array data for a menu link.
  281. */
  282. function adaptivetheme_menu_link(array $vars) {
  283. global $theme_key;
  284. $theme_name = $theme_key;
  285. $element = $vars['element'];
  286. $sub_menu = '';
  287. if ($element['#below']) {
  288. $sub_menu = drupal_render($element['#below']);
  289. }
  290. if (at_get_setting('extra_menu_classes', $theme_name) == 1 && !empty($element['#original_link'])) {
  291. if (!empty($element['#original_link']['depth'])) {
  292. $element['#attributes']['class'][] = 'menu-depth-' . $element['#original_link']['depth'];
  293. }
  294. if (!empty($element['#original_link']['mlid'])) {
  295. $element['#attributes']['class'][] = 'menu-item-' . $element['#original_link']['mlid'];
  296. }
  297. }
  298. if (at_get_setting('menu_item_span_elements', $theme_name) == 1 && !empty($element['#title'])) {
  299. $element['#title'] = '<span>' . $element['#title'] . '</span>';
  300. $element['#localized_options']['html'] = TRUE;
  301. }
  302. if (at_get_setting('unset_menu_titles', $theme_name) == 1 /* && !empty($element['#localized_options']['attributes']['title']) */) {
  303. unset($element['#localized_options']['attributes']['title']);
  304. }
  305. // Possible feature to show menu descriptions in span elements
  306. //if ($element['#original_link']['menu_name'] == "main-menu" && isset($element['#localized_options']['attributes']['title'])){
  307. // $element['#title'] = '<span class="title">' . $element['#title'] . '</span>';
  308. // $element['#title'] .= '<span class="description">' . $element['#localized_options']['attributes']['title'] . '</span>';
  309. // $element['#localized_options']['html'] = TRUE;
  310. //}
  311. $output = l($element['#title'], $element['#href'], $element['#localized_options']);
  312. return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>";
  313. }
  314. }
  315. /**
  316. * Returns HTML for a set of links.
  317. *
  318. * @param $vars
  319. * An associative array containing:
  320. * - links: An associative array of links to be themed. The key for each link
  321. * is used as its CSS class. Each link should be itself an array, with the
  322. * following elements:
  323. * - title: The link text.
  324. * - href: The link URL. If omitted, the 'title' is shown as a plain text
  325. * item in the links list.
  326. * - html: (optional) Whether or not 'title' is HTML. If set, the title
  327. * will not be passed through check_plain().
  328. * - attributes: (optional) Attributes for the anchor, or for the <span> tag
  329. * used in its place if no 'href' is supplied. If element 'class' is
  330. * included, it must be an array of one or more class names.
  331. * If the 'href' element is supplied, the entire link array is passed to l()
  332. * as its $options parameter.
  333. * - attributes: A keyed array of attributes for the UL containing the
  334. * list of links.
  335. * - heading: (optional) A heading to precede the links. May be an associative
  336. * array or a string. If it's an array, it can have the following elements:
  337. * - text: The heading text.
  338. * - level: The heading level (e.g. 'h2', 'h3').
  339. * - class: (optional) An array of the CSS classes for the heading.
  340. * When using a string it will be used as the text of the heading and the
  341. * level will default to 'h2'. Headings should be used on navigation menus
  342. * and any list of links that consistently appears on multiple pages. To
  343. * make the heading invisible use the 'element-invisible' CSS class. Do not
  344. * use 'display:none', which removes it from screen-readers and assistive
  345. * technology. Headings allow screen-reader and keyboard only users to
  346. * navigate to or skip the links. See
  347. * http://juicystudio.com/article/screen-readers-display-none.php and
  348. * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information.
  349. */
  350. function adaptivetheme_links($vars) {
  351. $links = $vars['links'];
  352. $attributes = $vars['attributes'];
  353. $heading = $vars['heading'];
  354. global $language_url;
  355. $output = '';
  356. if (count($links) > 0) {
  357. $output = '';
  358. if (!empty($heading)) {
  359. if (is_string($heading)) {
  360. $heading = array(
  361. 'text' => $heading,
  362. 'level' => 'h2',
  363. );
  364. }
  365. $output .= '<' . $heading['level'];
  366. if (!empty($heading['class'])) {
  367. $output .= drupal_attributes(array('class' => $heading['class']));
  368. }
  369. if (!empty($heading['id'])) {
  370. $output .= drupal_attributes(array('id' => $heading['id']));
  371. }
  372. $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
  373. }
  374. $output .= '<ul' . drupal_attributes($attributes) . '>';
  375. $num_links = count($links);
  376. $i = 1;
  377. foreach ($links as $key => $link) {
  378. // Extra menu classes
  379. if (at_get_setting('extra_menu_classes')) {
  380. $class = array($key);
  381. if ($i == 1) {
  382. $class[] = 'first';
  383. }
  384. if ($i == $num_links) {
  385. $class[] = 'last';
  386. }
  387. if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
  388. && (empty($link['language']) || $link['language']->language == $language_url->language)) {
  389. $class[] = 'active';
  390. }
  391. $output .= '<li' . drupal_attributes(array('class' => $class)) . '>';
  392. }
  393. else {
  394. $output .= '<li>';
  395. }
  396. if (isset($link['href'])) {
  397. if (at_get_setting('menu_item_span_elements')) {
  398. $link['title'] = '<span>' . $link['title'] . '</span>';
  399. $link['html'] = TRUE;
  400. }
  401. $output .= l($link['title'], $link['href'], $link);
  402. }
  403. elseif (!empty($link['title'])) {
  404. if (empty($link['html'])) {
  405. $link['title'] = check_plain($link['title']);
  406. }
  407. $span_attributes = '';
  408. if (isset($link['attributes'])) {
  409. $span_attributes = drupal_attributes($link['attributes']);
  410. }
  411. $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';
  412. }
  413. $i++;
  414. $output .= "</li>";
  415. }
  416. $output .= '</ul>';
  417. }
  418. return $output;
  419. }
  420. /**
  421. * Returns HTML for a field.
  422. *
  423. * Adaptivetheme overrides this in order to better support HTML5 by setting the
  424. * wrapper as section or div element depending on whether a title is used or not.
  425. * Fields have no title, instead it treats the field lable as if it were a title
  426. * and wraps it in h2 elements.
  427. *
  428. * This is the default theme implementation to display the value of a field.
  429. * Theme developers who are comfortable with overriding theme functions may do
  430. * so in order to customize this markup. This function can be overridden with
  431. * varying levels of specificity. For example, for a field named 'body'
  432. * displayed on the 'article' content type, any of the following functions will
  433. * override this default implementation. The first of these functions that
  434. * exists is used:
  435. * - THEMENAME_field__body__article()
  436. * - THEMENAME_field__article()
  437. * - THEMENAME_field__body()
  438. * - THEMENAME_field()
  439. *
  440. * Theme developers who prefer to customize templates instead of overriding
  441. * functions may copy the "field.tpl.php" from the "modules/field/theme" folder
  442. * of the Drupal installation to somewhere within the theme's folder and
  443. * customize it, just like customizing other Drupal templates such as
  444. * page.tpl.php or node.tpl.php. However, it takes longer for the server to
  445. * process templates than to call a function, so for websites with many fields
  446. * displayed on a page, this can result in a noticeable slowdown of the website.
  447. * For these websites, developers are discouraged from placing a field.tpl.php
  448. * file into the theme's folder, but may customize templates for specific
  449. * fields. For example, for a field named 'body' displayed on the 'article'
  450. * content type, any of the following templates will override this default
  451. * implementation. The first of these templates that exists is used:
  452. * - field--body--article.tpl.php
  453. * - field--article.tpl.php
  454. * - field--body.tpl.php
  455. * - field.tpl.php
  456. * So, if the body field on the article content type needs customization, a
  457. * field--body--article.tpl.php file can be added within the theme's folder.
  458. * Because it's a template, it will result in slightly more time needed to
  459. * display that field, but it will not impact other fields, and therefore,
  460. * is unlikely to cause a noticeable change in website performance. A very rough
  461. * guideline is that if a page is being displayed with more than 100 fields and
  462. * they are all themed with a template instead of a function, it can add up to
  463. * 5% to the time it takes to display that page. This is a guideline only and
  464. * the exact performance impact depends on the server configuration and the
  465. * details of the website.
  466. *
  467. * @param $vars
  468. * An associative array containing:
  469. * - label_hidden: A boolean indicating to show or hide the field label.
  470. * - title_attributes: A string containing the attributes for the title.
  471. * - label: The label for the field.
  472. * - content_attributes: A string containing the attributes for the content's
  473. * div.
  474. * - items: An array of field items.
  475. * - item_attributes: An array of attributes for each item.
  476. * - classes: A string containing the classes for the wrapping div.
  477. * - attributes: A string containing the attributes for the wrapping div.
  478. *
  479. * @see template_preprocess_field()
  480. * @see template_process_field()
  481. * @see field.tpl.php
  482. */
  483. function adaptivetheme_field($vars) {
  484. $output = '';
  485. // Render the label, if it's not hidden.
  486. if (!$vars['label_hidden']) {
  487. $output .= '<h2 class="field-label"' . $vars['title_attributes'] . '>' . $vars['label'] . ':&nbsp;</h2>';
  488. }
  489. // Render the items.
  490. $output .= '<div class="field-items"' . $vars['content_attributes'] . '>';
  491. foreach ($vars['items'] as $delta => $item) {
  492. $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
  493. $output .= '<div class="' . $classes . '"' . $vars['item_attributes'][$delta] . '>' . drupal_render($item) . '</div>';
  494. }
  495. $output .= '</div>';
  496. // Render the top-level wrapper element.
  497. $tag = $vars['tag'];
  498. $output = "<$tag class=\"" . $vars['classes'] . '"' . $vars['attributes'] . '>' . $output . "</$tag>";
  499. return $output;
  500. }
  501. /**
  502. * Returns HTML for a taxonomy field.
  503. *
  504. * Output taxonomy term fields as unordered lists.
  505. */
  506. function adaptivetheme_field__taxonomy_term_reference($vars) {
  507. $output = '';
  508. // Render the label, if it's not hidden.
  509. if (!$vars['label_hidden']) {
  510. $output .= '<h2 class="field-label"' . $vars['title_attributes'] . '>' . $vars['label'] . ':&nbsp;</h2>';
  511. }
  512. // Render the items.
  513. $output .= '<ul class="field-items"' . $vars['content_attributes'] . '>';
  514. foreach ($vars['items'] as $delta => $item) {
  515. $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
  516. $output .= '<li class="' . $classes . '"' . $vars['item_attributes'][$delta] . '>' . drupal_render($item) . '</li>';
  517. }
  518. $output .= '</ul>';
  519. // Render the top-level wrapper element.
  520. $tag = $vars['tag'];
  521. $output = "<$tag class=\"" . $vars['classes'] . '"' . $vars['attributes'] . '>' . $output . "</$tag>";
  522. return $output;
  523. }
  524. /**
  525. * Returns HTML for an image field.
  526. *
  527. * Output image fields as figure with figcaption for captioning.
  528. */
  529. function adaptivetheme_field__image($vars) {
  530. global $theme_key;
  531. $theme_name = $theme_key;
  532. // Check if image settings are enabled
  533. $image_settings_enabled = at_get_setting('enable_image_settings', $theme_name) === 1 ? TRUE : FALSE;
  534. // Check if captions are enabled for full and/or teaser view modes
  535. if ($image_settings_enabled == TRUE) {
  536. $caption_full = at_get_setting('image_caption_full', $theme_name) === 1 ? TRUE : FALSE;
  537. $caption_teaser = at_get_setting('image_caption_teaser', $theme_name) === 1 ? TRUE : FALSE;
  538. }
  539. $output = '';
  540. // Render the label, if it's not hidden.
  541. if (!$vars['label_hidden']) {
  542. $output .= '<h2 class="field-label"' . $vars['title_attributes'] . '>' . $vars['label'] . ':&nbsp;</h2>';
  543. }
  544. // Render the items.
  545. $output .= '<div class="field-items"' . $vars['content_attributes'] . '>';
  546. foreach ($vars['items'] as $delta => $item) {
  547. $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
  548. $output .= '<figure class="clearfix ' . $classes . '"' . $vars['item_attributes'][$delta] .'>';
  549. $output .= drupal_render($item);
  550. // Captions
  551. if (isset($item['#item']['title']) && !empty($item['#item']['title']) && $image_settings_enabled == TRUE) {
  552. // Ouch this is ugly, please tell me how to get the actual width of the image.
  553. // image_style_load($item['#image_style']); will return the image style dimensions,
  554. // but not the actual image width, which can be different, say when images
  555. // scale, but I cannot decipher where these dimensions come from when
  556. // the item is rendered.
  557. preg_match('/< *img[^>]*width *= *["\']?([^"\']*)/i', $item['#children'], $matches);
  558. $width = isset($matches[1]) ? $matches[1] . 'px' : 'auto';
  559. $styles = 'style="width:' . $width . ';"';
  560. if ($vars['field_view_mode'] == 'full') {
  561. if ($caption_full == TRUE) {
  562. $output .= '<figcaption class="caption full-caption"' . $styles .'>' . $item['#item']['title'] . '</figcaption>';
  563. }
  564. }
  565. if ($vars['field_view_mode'] == 'teaser') {
  566. if ($caption_teaser == TRUE) {
  567. $output .= '<figcaption class="caption teaser-caption"' . $styles .'>' . $item['#item']['title'] . '</figcaption>';
  568. }
  569. }
  570. }
  571. $output .= '</figure>';
  572. }
  573. $output .= '</div>';
  574. // Render the top-level wrapper element.
  575. $tag = $vars['tag'];
  576. $output = "<$tag class=\"" . $vars['classes'] . '"' . $vars['attributes'] . '>' . $output . "</$tag>";
  577. return $output;
  578. }
  579. /**
  580. * Table no_striping boilerplate.
  581. */
  582. /*
  583. function adaptivetheme_preprocess_table(&$variables) {
  584. $rows = $variables['rows'];
  585. foreach ($rows as $number => $row) {
  586. $variables['rows'][$number]['no_striping'] = TRUE;
  587. }
  588. }
  589. */
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.