123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- /**
- * Implementation of hook_theme().
- */
- function guibik_theme() {
- $items = array();
- // Content theming.
- $items['help'] =
- $items['node'] =
- $items['comment'] =
- $items['comment_wrapper'] = array(
- 'path' => drupal_get_path('theme', 'rubik') .'/templates',
- 'template' => 'object',
- );
- $items['node']['template'] = 'node';
- // Help pages really need help. See preprocess_page().
- $items['help_page'] = array(
- 'variables' => array('content' => array()),
- 'path' => drupal_get_path('theme', 'rubik') .'/templates',
- 'template' => 'object',
- 'preprocess functions' => array(
- 'template_preprocess',
- 'rubik_preprocess_help_page',
- ),
- 'process functions' => array('template_process'),
- );
- // Form layout: default (2 column).
- $items['block_add_block_form'] =
- $items['block_admin_configure'] =
- $items['comment_form'] =
- $items['contact_admin_edit'] =
- $items['contact_mail_page'] =
- $items['contact_mail_user'] =
- $items['filter_admin_format_form'] =
- $items['forum_form'] =
- $items['locale_languages_edit_form'] =
- $items['menu_edit_menu'] =
- $items['menu_edit_item'] =
- $items['node_type_form'] =
- $items['path_admin_form'] =
- $items['system_settings_form'] =
- $items['system_themes_form'] =
- $items['system_modules'] =
- $items['system_actions_configure'] =
- $items['taxonomy_form_term'] =
- $items['taxonomy_form_vocabulary'] =
- $items['user_profile_form'] =
- $items['user_admin_access_add_form'] = array(
- 'render element' => 'form',
- 'path' => drupal_get_path('theme', 'guibik') .'/templates',
- 'template' => 'form-default',
- 'preprocess functions' => array(
- 'rubik_preprocess_form_buttons',
- ),
- );
- // These forms require additional massaging.
- $items['confirm_form'] = array(
- 'render element' => 'form',
- 'path' => drupal_get_path('theme', 'rubik') .'/templates',
- 'template' => 'form-simple',
- 'preprocess functions' => array(
- 'rubik_preprocess_form_confirm'
- ),
- );
- $items['node_form'] = array(
- 'render element' => 'form',
- 'path' => drupal_get_path('theme', 'guibik') .'/templates',
- 'template' => 'form-default',
- 'preprocess functions' => array(
- 'rubik_preprocess_form_buttons',
- 'rubik_preprocess_form_node',
- ),
- );
- return $items;
- }
- /**
- * Preprocessor for theme('page').
- */
- function guibik_preprocess_page(&$vars) {
- // Show a warning if base theme is not present.
- if (!function_exists('rubik_theme') && user_access('administer site configuration')) {
- 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');
- }
- // Process local tasks. Only do this processing if the current theme is
- // indeed Rubik. Subthemes must reimplement this call.
- global $theme;
- if ($theme === 'guibik')
- _rubik_local_tasks($vars);
- }
- function guibik_preprocess_html(&$vars){
-
- $heads['icon'] = array(
- '#tag' => 'link',
- '#attributes' => array(
- 'href' => base_path() . path_to_theme() .'/icon.png',
- 'rel' => 'shortcut icon',
- 'type' => 'image/png',
- ),
- );
-
-
- $heads['apple-touch-icon'] = array(
- '#tag' => 'link',
- '#attributes' => array(
- 'href' => base_path() . path_to_theme() .'/apple-touch-icon.png',
- 'rel' => 'apple-touch-icon',
- ),
- );
- foreach ($heads as $type=>$head)
- drupal_add_html_head($head, $type);
- }
- function guibik_preprocess_views_view_table(&$vars){
- if($vars['title'] != ''){
- $vars['classes_array'][] = 'has-caption';
- }
- // dsm($vars);
- }
- /**
- * Implements hook_form_node_form_alter().
- */
- function guibik_form_node_form_alter(&$form, &$form_state){
- // dsm($form, 'guibik_form_node_form_alter | $form');
- // dsm($form_state, '$form_state');
- if(!isset($form['language']['#description']))
- $form['language']['#description'] = t('Please consider to leave language in neutral state <strong>if you dont plan to translate this node</strong>, even if your content is (obviously) writed in some non neutral language. Then this node will always be visible.');
- }
- function guibik_image_field_widget_process($element, &$form_state, $form){
- $element['title']['#type'] = "textarea";
- return $element;
- }
- /**
- * Implements hook_field_widget_form_alter().
- */
- function guibik_field_widget_form_alter(&$element, &$form_state, $context) {
- // dsm($context['field']['type'], '$context[field][type]');
- if ($context['field']['type'] == 'image') {
- foreach ($element as $delta => $item) {
- if(!isset($element[$delta]['#process']) || !is_array($element[$delta]['#process']))
- continue;
-
- $element[$delta]['#process'][] = "guibik_image_field_widget_process";
- }
- }
- }
|