Commit 398735ef authored by frjo's avatar frjo
Browse files

#1018644: Fixes for the unfineched insert module. Insert module only works on...

#1018644: Fixes for the unfineched insert module. Insert module only works on D7 with a number of patches.
parent 39d35d6f
......@@ -439,7 +439,9 @@ function colorbox_field_formatter_view($entity_type, $entity, $field, $instance,
*/
function colorbox_insert_styles() {
$insert_styles = array();
$insert_styles = colorbox_field_formatter_info();
foreach (image_styles() as $key => $style) {
$insert_styles['colorbox__' . $key] = array('label' => 'Colorbox ' . $style['name']);
}
return $insert_styles;
}
......@@ -448,6 +450,6 @@ function colorbox_insert_styles() {
* Implementation of hook_insert_content().
*/
function colorbox_insert_content($item, $style, $widget) {
list($item['style_name'], $item['module_name']) = explode('__', $style['name'], 2);
list($item['module_name'], $item['style_name']) = explode('__', $style['name'], 2);
return theme('colorbox_insert_image', $item, $widget);
}
......@@ -112,15 +112,14 @@ function theme_colorbox_imagefield($variables) {
* Preprocess variables for the colorbox-insert-image.tpl.php file.
*/
function template_preprocess_colorbox_insert_image(&$variables) {
$variables['file'] = file_load($variables['item']['fid']);
$variables['style_name'] = $variables['item']['style_name'];
$variables['image_path'] = imagecache_create_url($variables['style_name'], $vars['file']->uri);
$variables['file'] = file_load($variables['fid']);
$variables['image_path'] = image_style_url($variables['style_name'], $variables['file']->uri);
if ($style_name = variable_get('colorbox_imagecache_preset', 0)) {
$variables['link_path'] = image_style_url($style_name, $vars['file']->uri);
if ($style_name = variable_get('colorbox_image_style', '')) {
$variables['link_path'] = image_style_url($style_name, $variables['file']->uri);
}
else {
$variables['link_path'] = file_create_url($vars['file']->uri);
$variables['link_path'] = file_create_url($variables['file']->uri);
}
$variables['gallery_id'] = '';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment