function template_preprocess_styles in Styles 6
Same name and namespace in other branches
- 6.2 themes/styles.theme.inc \template_preprocess_styles()
- 7.2 themes/styles.theme.inc \template_preprocess_styles()
- 7 styles.module \template_preprocess_styles()
File
- themes/
styles.theme.inc, line 20 - styles.theme.inc Theme and preprocess functions for the Styles project.
Code
function template_preprocess_styles(&$variables) {
$field_type = $variables['field_type'];
$style_name = $variables['style_name'];
$output = '';
$presets = styles_presets();
$containers = styles_containers();
$container = $containers[$field_type]['containers'];
foreach ($container as $container_name => $styles) {
$variables['container'] = $styles;
$variables['container_name'] = $variables['container']['name'];
$callback = $styles['filter callback'];
if (function_exists($callback)) {
if (call_user_func_array($callback, array(
$variables,
))) {
if (!empty($presets[$field_type][$style_name][$container_name])) {
$variables['preset'] = array_pop($presets[$field_type][$style_name][$container_name]);
$variables['preset_name'] = $variables['preset']['name'];
$variables['output'] = theme($styles['themes']['styles'], $field_type, $style_name, $variables['object'], $variables);
$variables['classes_array'][] = 'styles-field-' . $field_type;
$variables['classes_array'][] = 'styles-style-' . $style_name;
$variables['classes_array'][] = 'styles-container-' . $variables['container_name'];
$variables['classes_array'][] = 'styles-preset-' . $variables['preset_name'];
$variables['classes'] = implode(' ', $variables['classes_array']);
break;
}
}
}
}
}