template.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Implementation of hook_theme().
  4. */
  5. function guibik_theme() {
  6. $items = array();
  7. // Content theming.
  8. $items['help'] =
  9. $items['node'] =
  10. $items['comment'] =
  11. $items['comment_wrapper'] = array(
  12. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  13. 'template' => 'object',
  14. );
  15. $items['node']['template'] = 'node';
  16. // Help pages really need help. See preprocess_page().
  17. $items['help_page'] = array(
  18. 'variables' => array('content' => array()),
  19. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  20. 'template' => 'object',
  21. 'preprocess functions' => array(
  22. 'template_preprocess',
  23. 'rubik_preprocess_help_page',
  24. ),
  25. 'process functions' => array('template_process'),
  26. );
  27. // Form layout: default (2 column).
  28. $items['block_add_block_form'] =
  29. $items['block_admin_configure'] =
  30. $items['comment_form'] =
  31. $items['contact_admin_edit'] =
  32. $items['contact_mail_page'] =
  33. $items['contact_mail_user'] =
  34. $items['filter_admin_format_form'] =
  35. $items['forum_form'] =
  36. $items['locale_languages_edit_form'] =
  37. $items['menu_edit_menu'] =
  38. $items['menu_edit_item'] =
  39. $items['node_type_form'] =
  40. $items['path_admin_form'] =
  41. $items['system_settings_form'] =
  42. $items['system_themes_form'] =
  43. $items['system_modules'] =
  44. $items['system_actions_configure'] =
  45. $items['taxonomy_form_term'] =
  46. $items['taxonomy_form_vocabulary'] =
  47. $items['user_profile_form'] =
  48. $items['user_admin_access_add_form'] = array(
  49. 'render element' => 'form',
  50. 'path' => drupal_get_path('theme', 'guibik') .'/templates',
  51. 'template' => 'form-default',
  52. 'preprocess functions' => array(
  53. 'rubik_preprocess_form_buttons',
  54. ),
  55. );
  56. // These forms require additional massaging.
  57. $items['confirm_form'] = array(
  58. 'render element' => 'form',
  59. 'path' => drupal_get_path('theme', 'rubik') .'/templates',
  60. 'template' => 'form-simple',
  61. 'preprocess functions' => array(
  62. 'rubik_preprocess_form_confirm'
  63. ),
  64. );
  65. $items['node_form'] = array(
  66. 'render element' => 'form',
  67. 'path' => drupal_get_path('theme', 'guibik') .'/templates',
  68. 'template' => 'form-default',
  69. 'preprocess functions' => array(
  70. 'rubik_preprocess_form_buttons',
  71. 'rubik_preprocess_form_node',
  72. ),
  73. );
  74. return $items;
  75. }
  76. /**
  77. * Preprocessor for theme('page').
  78. */
  79. function guibik_preprocess_page(&$vars) {
  80. // Show a warning if base theme is not present.
  81. if (!function_exists('rubik_theme') && user_access('administer site configuration')) {
  82. drupal_set_message(t('The Guibik theme requires the !rubik base theme in order to work properly.', array('!rubik' => l('Rubik', 'http://code.developmentseed.org/tao'))), 'warning');
  83. }
  84. // Process local tasks. Only do this processing if the current theme is
  85. // indeed Rubik. Subthemes must reimplement this call.
  86. global $theme;
  87. if ($theme === 'guibik')
  88. _rubik_local_tasks($vars);
  89. }