template.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @file template.php
  4. *
  5. */
  6. /**
  7. * Implementation of hook_theme
  8. */
  9. function materiobasetheme_theme() {
  10. $path = drupal_get_path('theme', 'materiobasetheme');
  11. # Register theme function for the system_settings_form.
  12. return array(
  13. 'system_settings_form' => array(
  14. 'arguments' => array('form' => NULL, 'key' => 'materiobasetheme'),
  15. ),
  16. );
  17. # Include the theme settings.
  18. include($path .'/inc/template.theme-settings.inc');
  19. }
  20. /**
  21. * Implementation of hook_preprocess()
  22. *
  23. * This function checks to see if a hook has a preprocess file associated with
  24. * it, and if so, loads it.
  25. *
  26. * @param $vars
  27. * An array of variables to pass to the theme template.
  28. * @param $hook
  29. * The name of the template being rendered.
  30. */
  31. function materiobasetheme_preprocess(&$vars, $hook) {
  32. global $theme, $theme_info, $user, $language;
  33. $vars['is_admin'] = in_array('admin', $user->roles);
  34. $vars['logged_in'] = ($user->uid > 0) ? TRUE : FALSE;
  35. $vars['theme_path'] = base_path() . path_to_theme() .'/';
  36. // $vars['classes_array'][] = $hook.' '.$hook.'-'.$vars['zebra'];
  37. // dsm($hook, 'hook');
  38. # Include preprocess functions if and when required.
  39. $path = drupal_get_path('theme', 'materiobasetheme');
  40. $file = $path .'/preprocess/'. str_replace('_', '-', $hook) .'.pre.php';
  41. if (is_file($file)) {
  42. include($file);
  43. }
  44. }
  45. $path = drupal_get_path('theme', 'materiobasetheme');
  46. # Include custom functions.
  47. include_once($path .'/inc/template.custom-functions.inc');
  48. # Include theme overrides.
  49. include_once($path .'/inc/template.theme-overrides.inc');
  50. # Include some jQuery.
  51. // include_once(drupal_get_path('theme', 'materiobasetheme') .'/inc/template.theme-js.inc');