function template_preprocess_lightbox2_insert_image in Lightbox2 6
Same name and namespace in other branches
- 8 lightbox2.insert.inc \template_preprocess_lightbox2_insert_image()
- 7.2 lightbox2.insert.inc \template_preprocess_lightbox2_insert_image()
- 7 lightbox2.insert.inc \template_preprocess_lightbox2_insert_image()
Theme the content that will be inserted for Lightbox2 presets.
File
- ./
lightbox2.insert.inc, line 42 - Lightbox2 support for Insert module.
Code
function template_preprocess_lightbox2_insert_image(&$vars) {
if ($vars['image_preset_name'] != 'original') {
$filepath = imagecache_create_path($vars['image_preset_name'], $vars['item']['filepath']);
}
else {
$filepath = $vars['item']['filepath'];
}
$vars['url'] = insert_create_url($filepath);
if ($vars['link_preset_name'] != 'original') {
$linkpath = imagecache_create_path($vars['link_preset_name'], $vars['item']['filepath']);
}
else {
$linkpath = $vars['item']['filepath'];
}
$vars['linkurl'] = insert_create_url($linkpath);
$vars['download_link'] = '';
$download_link_text = check_plain(variable_get('lightbox2_download_link_text', 'Download Original'));
if (!empty($download_link_text) && user_access('download original image')) {
$vars['download_link'] = '<br /><br />' . l($download_link_text, $vars['linkurl'], array(
'attributes' => array(
'target' => '_blank',
'id' => 'lightbox2-download-link-text',
),
));
}
$vars['class'] = !empty($vars['widget']['insert_class']) ? $vars['widget']['insert_class'] : '';
}