function _designkit_preprocess in DesignKit 7
Helper function to turn design choices into theme variables.
2 calls to _designkit_preprocess()
- designkit_preprocess_html in ./
designkit.module - Implements hook_preprocess_html().
- designkit_preprocess_page in ./
designkit.module - Implements hook_preprocess_page().
File
- ./
designkit.module, line 39
Code
function _designkit_preprocess(&$variables) {
static $color;
static $image;
static $styles;
$info = designkit_get_info();
if (empty($styles)) {
$color = !empty($info['designkit']['color']) ? variable_get('designkit_color', array()) : array();
$image = designkit_get_image_info();
// Generate CSS styles.
if ($image || array_filter($color, 'designkit_valid_color')) {
// Add styles.
$styles = theme('designkit', array(
'color' => $color,
'image' => $image,
));
drupal_add_css($styles, array(
'type' => 'inline',
'group' => CSS_THEME,
'weight' => 200,
));
}
}
// Clear out stale values for image keys. This prevents themes from
// getting unexpected values if no images have been set.
if (!empty($info['designkit']['image'])) {
foreach (array_keys($info['designkit']['image']) as $name) {
if (isset($variables[$name])) {
unset($variables[$name]);
}
}
}
// Provide in separate variable for themes that reset or blow away styles.
// Add in designkit styles.
$variables['classes_array'][] = 'designkit';
$variables['designkit'] = $styles;
foreach ($image as $name => $options) {
// Don't process the logo, since we are using core's standard logo path.
if ($name == 'logo') {
continue;
}
$variables[$name] = theme('designkit_image', $options);
}
}