Revision c2f02e8f
Added by Andreas Kohlbecker over 10 years ago
7.x/themes/zen_dataportal/template.php | ||
---|---|---|
101 | 101 |
* http://drupal.org/node/223440 and http://drupal.org/node/1089656 |
102 | 102 |
*/ |
103 | 103 |
|
104 |
/** |
|
105 |
* @param $which_image |
|
106 |
* name of the image, see _zen_dataportal_imagenames() for possible values |
|
107 |
* @param $variables |
|
108 |
* An array of variables to pass to the theme template. |
|
109 |
* @param $attributes_key |
|
110 |
* |
|
111 |
* @param $background_style |
|
112 |
* |
|
113 |
* @see _zen_dataportal_imagenames() for possible values |
|
114 |
*/ |
|
115 |
function _set_image_url($which_image, &$variables, $attributes_key = NULL, $background_style = 'scroll repeat') { |
|
116 |
|
|
117 |
if($attributes_key) { |
|
118 |
$variables[$attributes_key] = ''; |
|
119 |
} |
|
120 |
|
|
121 |
if (!theme_get_setting('default_' . $which_image)) { |
|
122 |
$path = theme_get_setting($which_image . '_path'); |
|
123 |
if(isset($path)){ |
|
124 |
if (file_uri_scheme($path) == 'public') { |
|
125 |
$url = file_create_url($path); |
|
126 |
} |
|
127 |
if(isset($url)) { |
|
128 |
$variables[$which_image . '_url'] = $url; |
|
129 |
if($attributes_key) { |
|
130 |
// FIXME is not save only works if no other style given e.g. html.php $attributes |
|
131 |
$variables[$attributes_key] = ' style="background: white url(' . $url .') ' . $background_style . ';"'; |
|
132 |
} |
|
133 |
} |
|
134 |
|
|
135 |
} |
|
136 |
} |
|
137 |
} |
|
138 |
/** |
|
139 |
* |
|
140 |
*/ |
|
141 |
function _add_inline_styles(&$variables) { |
|
142 |
|
|
143 |
$css = array(); |
|
144 |
$variables['inline_styles'] = ''; |
|
145 |
|
|
146 |
// site_name |
|
147 |
if(theme_get_setting('site_name_color')) { |
|
148 |
$css[] = "#site-name a span {color:" . theme_get_setting('site_name_color') . ';}'; |
|
149 |
} |
|
150 |
|
|
151 |
$variables['inline_styles'] = '<style type="text/css">'. "\n" . implode("\n", $css) . '</style>'; |
|
152 |
} |
|
153 |
|
|
104 | 154 |
|
105 | 155 |
/** |
106 | 156 |
* Override or insert variables into the maintenance page template. |
... | ... | |
128 | 178 |
* @param $hook |
129 | 179 |
* The name of the template being rendered ("html" in this case.) |
130 | 180 |
*/ |
131 |
/* -- Delete this line if you want to use this function |
|
132 |
function STARTERKIT_preprocess_html(&$variables, $hook) { |
|
133 |
$variables['sample_variable'] = t('Lorem ipsum.'); |
|
134 |
|
|
135 |
// The body tag's classes are controlled by the $classes_array variable. To |
|
136 |
// remove a class from $classes_array, use array_diff(). |
|
137 |
//$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove')); |
|
181 |
function zen_dataportal_preprocess_html(&$variables, $hook) { |
|
182 |
_set_image_url('body_background', $variables, 'attributes'); |
|
183 |
_add_inline_styles($variables); |
|
138 | 184 |
} |
139 |
// */ |
|
140 | 185 |
|
141 | 186 |
/** |
142 | 187 |
* Override or insert variables into the page templates. |
... | ... | |
146 | 191 |
* @param $hook |
147 | 192 |
* The name of the template being rendered ("page" in this case.) |
148 | 193 |
*/ |
149 |
/* -- Delete this line if you want to use this function
|
|
150 |
function STARTERKIT_preprocess_page(&$variables, $hook) {
|
|
151 |
$variables['sample_variable'] = t('Lorem ipsum.');
|
|
194 |
function zen_dataportal_preprocess_page(&$variables, $hook) {
|
|
195 |
_set_image_url('banner', $variables, 'banner_attributes', 'scroll no-repeat content-box');
|
|
196 |
_set_image_url('page_background', $variables, 'page_attributes');
|
|
152 | 197 |
} |
153 |
// */ |
|
154 | 198 |
|
155 | 199 |
/** |
156 | 200 |
* Override or insert variables into the node templates. |
Also available in: Unified diff
colors configurable