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', 'rubik') .'/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', 'rubik') .'/templates', 'template' => 'form-default', 'preprocess functions' => array( 'rubik_preprocess_form_buttons', 'rubik_preprocess_form_node', ), ); return $items; } /** * Preprocessor for theme('page'). */ function rubik_preprocess_page(&$vars) { // Show a warning if base theme is not present. if (!function_exists('tao_theme') && user_access('administer site configuration')) { drupal_set_message(t('The Rubik theme requires the !tao base theme in order to work properly.', array('!tao' => l('Tao', 'http://code.developmentseed.org/tao'))), 'warning'); } // Set a page icon class. $vars['page_icon_class'] = ($item = menu_get_item()) ? implode(' ' , _rubik_icon_classes($item['href'])) : ''; // Help pages. They really do need help. if (strpos($_GET['q'], 'admin/help/') === 0 && isset($vars['page']['content']['system_main']['main']['#markup'])) { $vars['page']['content']['system_main']['main']['#markup'] = theme('help_page', array('content' => $vars['page']['content']['system_main']['main']['#markup'])); } // Clear out help text if empty. if (empty($vars['help']) || !(strip_tags($vars['help']))) { $vars['help'] = ''; } // Process local tasks. Only do this processing if the current theme is // indeed Rubik. Subthemes must reimplement this call. global $theme; if ($theme === 'rubik') { _rubik_local_tasks($vars); } // Overlay is enabled. $vars['overlay'] = (module_exists('overlay') && overlay_get_mode() === 'child'); } /** * Preprocessor for theme('fieldset'). */ function rubik_preprocess_fieldset(&$vars) { if (!empty($vars['element']['#collapsible'])) { $vars['title'] = "" . $vars['title']; } } /** * Preprocessor for handling form button for most forms. */ function rubik_preprocess_form_buttons(&$vars) { if (!empty($vars['form']['actions'])) { $vars['actions'] = $vars['form']['actions']; unset($vars['form']['actions']); } } /** * Preprocessor for theme('confirm_form'). */ function rubik_preprocess_form_confirm(&$vars) { // Move the title from the page title (usually too big and unwieldy) $title = filter_xss_admin(drupal_get_title()); $vars['form']['description']['#type'] = 'item'; $vars['form']['description']['#value'] = empty($vars['form']['description']['#value']) ? "{$title}" : "{$title}
{$vars['form']['description']['#value']}
"; drupal_set_title(t('Please confirm')); } /** * Preprocessor for theme('node_form'). */ function rubik_preprocess_form_node(&$vars) { $vars['sidebar'] = isset($vars['sidebar']) ? $vars['sidebar'] : array(); // Support nodeformcols if present. if (module_exists('nodeformcols')) { $map = array( 'nodeformcols_region_right' => 'sidebar', 'nodeformcols_region_footer' => 'footer', 'nodeformcols_region_main' => NULL, ); foreach ($map as $region => $target) { if (isset($vars['form'][$region])) { if (isset($vars['form'][$region]['#prefix'], $vars['form'][$region]['#suffix'])) { unset($vars['form'][$region]['#prefix']); unset($vars['form'][$region]['#suffix']); } if (isset($vars['form'][$region]['actions'], $vars['form'][$region]['actions'])) { $vars['actions'] = $vars['form'][$region]['actions']; unset($vars['form'][$region]['actions']); } if (isset($target)) { $vars[$target] = $vars['form'][$region]; unset($vars['form'][$region]); } } } } // Default to showing taxonomy in sidebar if nodeformcols is not present. elseif (isset($vars['form']['taxonomy']) && empty($vars['sidebar'])) { $vars['sidebar']['taxonomy'] = $vars['form']['taxonomy']; unset($vars['form']['taxonomy']); } } /** * Preprocessor for theme('button'). */ function rubik_preprocess_button(&$vars) { if (isset($vars['element']['#value'])) { $classes = array( t('Save') => 'yes', t('Submit') => 'yes', t('Add') => 'yes', t('Delete') => 'no', t('Cancel') => 'no', ); foreach ($classes as $search => $class) { if (strpos($vars['element']['#value'], $search) !== FALSE) { $vars['element']['#attributes']['class'][] = 'button-' . $class; break; } } } } /** * Preprocessor for theme('help'). */ function rubik_preprocess_help(&$vars) { $vars['hook'] = 'help'; $vars['attr']['id'] = 'help-text'; $class = 'path-admin-help clear-block toggleable'; $vars['attr']['class'] = isset($vars['attr']['class']) ? "{$vars['attr']['class']} $class" : $class; $help = menu_get_active_help(); if (($test = strip_tags($help)) && !empty($help)) { // Thankfully this is static cached. $vars['attr']['class'] .= menu_secondary_local_tasks() ? ' with-tabs' : ''; $vars['is_prose'] = TRUE; $vars['layout'] = TRUE; $vars['content'] = "" . $help; // Link to help section. $item = menu_get_item('admin/help'); if ($item && $item['path'] === 'admin/help' && $item['access']) { $vars['links'] = l(t('More help topics'), 'admin/help'); } } } /** * Preprocessor for theme('help_page'). */ function rubik_preprocess_help_page(&$vars) { $vars['hook'] = 'help-page'; $vars['title_attributes_array']['class'][] = 'help-page-title'; $vars['title_attributes_array']['class'][] = 'clearfix'; $vars['content_attributes_array']['class'][] = 'help-page-content'; $vars['content_attributes_array']['class'][] = 'clearfix'; $vars['content_attributes_array']['class'][] = 'prose'; $vars['layout'] = TRUE; // Truly hackish way to navigate help pages. $module_info = system_rebuild_module_data(); $modules = array(); foreach (module_implements('help', TRUE) as $module) { if (module_invoke($module, 'help', "admin/help#$module", NULL)) { $modules[$module] = $module_info[$module]->info['name']; } } asort($modules); $links = array(); foreach ($modules as $module => $name) { $links[] = array('title' => $name, 'href' => "admin/help/{$module}"); } $vars['links'] = theme('links', array('links' => $links)); } /** * Preprocessor for theme('node'). */ function rubik_preprocess_node(&$vars) { $vars['layout'] = TRUE; $vars['submitted'] = _rubik_submitted($vars['node']); } /** * Preprocessor for theme('comment'). */ function rubik_preprocess_comment(&$vars) { $vars['layout'] = TRUE; $vars['submitted'] = _rubik_submitted($vars['comment']); } /** * Preprocessor for theme('comment_wrapper'). */ function rubik_preprocess_comment_wrapper(&$vars) { $vars['hook'] = 'box'; $vars['layout'] = FALSE; $vars['title'] = t('Comments'); $vars['attributes_array']['id'] = 'comments'; $vars['title_attributes_array']['class'][] = 'box-title'; $vars['title_attributes_array']['class'][] = 'clearfix'; $vars['content_attributes_array']['class'][] = 'box-content'; $vars['content_attributes_array']['class'][] = 'clearfix'; $vars['content_attributes_array']['class'][] = 'prose'; $vars['content'] = drupal_render_children($vars['content']); } /** * Preprocessor for theme('admin_block'). */ function rubik_preprocess_admin_block(&$vars) { // Add icon and classes to admin block titles. if (isset($vars['block']['href'])) { $vars['block']['localized_options']['attributes']['class'] = _rubik_icon_classes($vars['block']['href']); } $vars['block']['localized_options']['html'] = TRUE; if (isset($vars['block']['link_title'])) { $vars['block']['title'] = l("" . filter_xss_admin($vars['block']['link_title']), $vars['block']['href'], $vars['block']['localized_options']); } if (empty($vars['block']['content'])) { $vars['block']['content'] = "