function template_preprocess_colorbox_insert_image in Colorbox 7
Same name and namespace in other branches
- 6 colorbox.theme.inc \template_preprocess_colorbox_insert_image()
- 7.2 colorbox.theme.inc \template_preprocess_colorbox_insert_image()
Preprocess variables for the colorbox-insert-image.tpl.php file.
File
- ./
colorbox.theme.inc, line 154 - Colorbox theme functions.
Code
function template_preprocess_colorbox_insert_image(&$variables) {
$class = array();
$file = file_load($variables['item']['fid']);
if (!empty($variables['widget']['settings']['insert_class'])) {
$class = explode(' ', $variables['widget']['settings']['insert_class']);
}
$class[] = 'image-' . $variables['item']['style_name'];
foreach ($class as $key => $value) {
$class[$key] = drupal_html_class($value);
}
$variables['image_path'] = image_style_url($variables['item']['style_name'], $file->uri);
if ($style_name = variable_get('colorbox_image_style', '')) {
$variables['link_path'] = image_style_url($style_name, $file->uri);
}
else {
$variables['link_path'] = file_create_url($file->uri);
}
$variables['class'] = implode(' ', $class);
$variables['gallery_id'] = '';
switch (variable_get('colorbox_insert_gallery', 0)) {
case 0:
case 1:
case 2:
$variables['gallery_id'] = 'gallery-all';
break;
case 3:
$variables['gallery_id'] = '';
break;
}
}