| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* The guts of the theme :)
|
| 7 |
*/
|
| 8 |
|
| 9 |
/*
|
| 10 |
* Initialize theme settings
|
| 11 |
*/
|
| 12 |
if (is_null(theme_get_setting('sky_layout'))) {
|
| 13 |
global $theme_key;
|
| 14 |
|
| 15 |
// Save default theme settings
|
| 16 |
$defaults = array(
|
| 17 |
'sky_background' => NULL,
|
| 18 |
'sky_background_header' => NULL,
|
| 19 |
'sky_breadcrumbs' => 0,
|
| 20 |
'sky_breadcrumbs_sep' => '»',
|
| 21 |
'sky_links' => NULL,
|
| 22 |
'sky_links_active' => NULL,
|
| 23 |
'sky_links_hover' => NULL,
|
| 24 |
'sky_links_visited' => NULL,
|
| 25 |
'sky_font' => 'lucida',
|
| 26 |
'sky_font_headings' => 'lucida',
|
| 27 |
'sky_font_size' => '12px',
|
| 28 |
'sky_header_height' => 'auto',
|
| 29 |
'sky_layout' => 'fixed_960',
|
| 30 |
'sky_custom_layout' => NULL,
|
| 31 |
'sky_nav_alignment' => 'center',
|
| 32 |
'sky_sub_navigation_size' => '15em',
|
| 33 |
);
|
| 34 |
|
| 35 |
// Get default theme settings.
|
| 36 |
$settings = theme_get_settings($theme_key);
|
| 37 |
// Don't save the toggle_node_info_ variables.
|
| 38 |
if (module_exists('node')) {
|
| 39 |
foreach (node_get_types() as $type => $name) {
|
| 40 |
unset($settings['toggle_node_info_'. $type]);
|
| 41 |
}
|
| 42 |
}
|
| 43 |
// Save default theme settings.
|
| 44 |
variable_set(
|
| 45 |
str_replace('/', '_', 'theme_'. $theme_key .'_settings'),
|
| 46 |
array_merge($defaults, $settings)
|
| 47 |
);
|
| 48 |
|
| 49 |
// Force refresh of Drupal internals
|
| 50 |
theme_get_setting('', TRUE);
|
| 51 |
}
|
| 52 |
|
| 53 |
/**
|
| 54 |
* Add Custom Generated CSS File
|
| 55 |
* This file is generated each time the theme settings page is loaded.
|
| 56 |
* @todo Test subthemes.
|
| 57 |
*/
|
| 58 |
$custom_css = file_directory_path() .'/sky/custom.css';
|
| 59 |
if (file_exists($custom_css)) {
|
| 60 |
drupal_add_css($custom_css, 'theme', 'all', TRUE);
|
| 61 |
}
|
| 62 |
|
| 63 |
/**
|
| 64 |
* Implementation of hook_theme().
|
| 65 |
* This function provides a one-stop reference for all
|
| 66 |
*/
|
| 67 |
function sky_theme() {
|
| 68 |
return array(
|
| 69 |
'breadcrumb' => array(
|
| 70 |
'arguments' => array('breadcrumb' => array()),
|
| 71 |
'file' => 'functions/theme-overrides.inc',
|
| 72 |
),
|
| 73 |
'conditional_stylesheets' => array(
|
| 74 |
'file' => 'functions/theme-custom.inc',
|
| 75 |
),
|
| 76 |
'feed_icon' => array(
|
| 77 |
'arguments' => array('url' => NULL, 'title' => NULL),
|
| 78 |
'file' => 'functions/theme-overrides.inc',
|
| 79 |
),
|
| 80 |
'form_element' => array(
|
| 81 |
'arguments' => array('element' => NULL, 'value' => NULL),
|
| 82 |
'file' => 'functions/theme-overrides.inc',
|
| 83 |
),
|
| 84 |
'fieldset' => array(
|
| 85 |
'arguments' => array('element' => NULL),
|
| 86 |
'file' => 'functions/theme-overrides.inc',
|
| 87 |
),
|
| 88 |
'menu_local_tasks' => array(
|
| 89 |
'arguments' => NULL,
|
| 90 |
'file' => 'functions/theme-overrides.inc',
|
| 91 |
),
|
| 92 |
'more_link' => array(
|
| 93 |
'arguments' => array('url' => array(), 'title' => NULL),
|
| 94 |
'file' => 'functions/theme-overrides.inc',
|
| 95 |
),
|
| 96 |
'pager' => array(
|
| 97 |
'arguments' => array('tags' => array(), 'limit' => NULL, 'element' => NULL, 'parameters' => array(), 'quantity' => NULL),
|
| 98 |
'file' => 'functions/theme-overrides.inc',
|
| 99 |
),
|
| 100 |
'status_messages' => array(
|
| 101 |
'arguments' => array('display' => NULL),
|
| 102 |
'file' => 'functions/theme-overrides.inc',
|
| 103 |
),
|
| 104 |
'status_report' => array(
|
| 105 |
'arguments' => array('requirements' => NULL),
|
| 106 |
'file' => 'functions/theme-overrides.inc',
|
| 107 |
),
|
| 108 |
'table' => array(
|
| 109 |
'arguments' => array('header' => NULL, 'rows' => NULL, 'attributes' => array(), 'caption' => NULL),
|
| 110 |
'file' => 'functions/theme-overrides.inc',
|
| 111 |
),
|
| 112 |
'render_attributes' => array(
|
| 113 |
'arguments' => array('attributes'),
|
| 114 |
'file' => 'functions/theme-custom.inc',
|
| 115 |
),
|
| 116 |
);
|
| 117 |
}
|
| 118 |
|
| 119 |
/**
|
| 120 |
* Implementation of hook_preprocess().
|
| 121 |
*
|
| 122 |
* @param $vars
|
| 123 |
* @param $hook
|
| 124 |
* @return Array
|
| 125 |
*/
|
| 126 |
function sky_preprocess(&$vars, $hook) {
|
| 127 |
|
| 128 |
// Only add the admin.css file to administrative pages
|
| 129 |
if (arg(0) == 'admin') {
|
| 130 |
drupal_add_css(path_to_theme() .'/css/admin.css', 'theme', 'all', TRUE);
|
| 131 |
}
|
| 132 |
|
| 133 |
/**
|
| 134 |
* This function checks to see if a hook has a preprocess file associated with
|
| 135 |
* it, and if so, loads it.
|
| 136 |
*/
|
| 137 |
if (is_file(drupal_get_path('theme', 'sky') .'/preprocess/preprocess-'. str_replace('_', '-', $hook) .'.inc')) {
|
| 138 |
include('preprocess/preprocess-'. str_replace('_', '-', $hook) .'.inc');
|
| 139 |
}
|
| 140 |
}
|