diff -up ./lightbox2.insert-image.tpl.php.insertstyles ./lightbox2.insert-image.tpl.php
--- ./lightbox2.insert-image.tpl.php.insertstyles 2010-01-27 10:23:07.000000000 +0000
+++ ./lightbox2.insert-image.tpl.php 2010-01-27 10:32:03.000000000 +0000
@@ -0,0 +1,26 @@
+ tag.
+ * - __title__: The Title text, intended for use in the
tag.
+ * - __description__: A description of the image, sometimes used as a caption.
+ */
+?>
+
\ No newline at end of file
diff -up ./lightbox2.insert.inc.insertstyles ./lightbox2.insert.inc
--- ./lightbox2.insert.inc.insertstyles 2010-01-27 10:23:07.000000000 +0000
+++ ./lightbox2.insert.inc 2010-01-27 11:13:40.000000000 +0000
@@ -0,0 +1,127 @@
+ 'Lightbox2: original->original',
+ );
+
+ // Handle imagecache presets.
+ if (module_exists('imagecache')) {
+ $rules = array();
+ if (function_exists('imagecache_presets')) {
+ $presets = imagecache_presets();
+ foreach ($presets as $preset_id => $preset_info) {
+ $rules[$preset_id] = $preset_info['presetname'];
+ }
+ }
+ else {
+ $rules = _imagecache_get_presets();
+ }
+ /*
+ $insert_styles['lightframe2--original--node'] = array(
+ 'label' => 'Lightbox2 iframe: original->node page',
+ );
+ */
+ foreach ($rules as $ruleid => $view_rule) {
+ $insert_styles['lightbox2--original--'. $view_rule] = array(
+ 'label' => 'Lightbox2: original->'. $view_rule,
+ );
+ $insert_styles['lightbox2--'. $view_rule .'--original'] = array(
+ 'label' => 'Lightbox2: '. $view_rule .'->original',
+ );
+ /*
+ $insert_styles['lightshow2--original--'. $view_rule] = array(
+ 'label' => 'Lightbox2 slideshow: original->'. $view_rule,
+ );
+ $insert_styles['lightshow2--'. $view_rule .'--original'] = array(
+ 'label' => 'Lightbox2 slideshow: '. $view_rule .'->original',
+ );
+ $insert_styles['lightframe2--'. $view_rule .'--node'] = array(
+ 'label' => 'Lightbox2 iframe: '. $view_rule .'->node page',
+ );
+ */
+ foreach ($rules as $rid => $lightbox_rule) {
+ $insert_styles['lightbox2--'. $view_rule .'--'. $lightbox_rule] = array(
+ 'label' => 'Lightbox2: '. $view_rule .'->'. $lightbox_rule,
+ );
+ /*
+ $insert_styles['lightshow2--'. $view_rule .'--'. $lightbox_rule] = array(
+ 'label' => 'Lightbox2 slideshow: '. $view_rule .'->'. $lightbox_rule,
+ );
+ */
+ }
+ }
+ }
+ /*
+ if (module_exists('emfield') && module_exists('emimage')) {
+ $insert_styles['emimage_lightbox2'] = array(
+ 'label' => t('Lightbox2: Image Thumbnail -> Original'),
+ );
+ $insert_styles['emimage_lightshow2'] = array(
+ 'label' => t('Lightbox2 slideshow: Image Thumbnail -> Original'),
+ );
+ $insert_styles['emimage_lightframe2'] = array(
+ 'label' => t('Lightbox2 iframe: Image Thumbnail -> Content'),
+ );
+ }
+ if (variable_get('lightbox2_enable_video', FALSE) && module_exists('emfield') && module_exists('emvideo')) {
+ $insert_styles['emvideo_lightvideo'] = array(
+ 'label' => t('Lightbox2: Image Thumbnail -> Full Size Video'),
+ );
+ }
+ if (module_exists('filefield')) {
+ $insert_styles['filefield_lightframe'] = array(
+ 'label' => t('Lightbox2 iframe'),
+ );
+ }
+ */
+ return $insert_styles;
+}
+
+/**
+ * Implementation of hook_insert_content().
+ */
+function lightbox2_insert_content($item, $style, $widget) {
+ if (preg_match('/^lightbox2--((?:-(?!-)|[^-])+)--((?:-(?!-)|[^-])+)$/',$style['name'],$matches)) {
+ $image_preset_name = $matches[1];
+ $link_preset_name = $matches[2];
+ return theme('lightbox2_insert_image', $item, $widget, 'view', $image_preset_name, $link_preset_name);
+ }
+ else {
+ return '';
+ }
+}
+
+/**
+ * Theme the content that will be inserted for Lightbox2 presets.
+ */
+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['class'] = !empty($vars['widget']['insert_class']) ? $vars['widget']['insert_class'] : '';
+}
diff -up ./lightbox2.module.insertstyles ./lightbox2.module
--- ./lightbox2.module.insertstyles 2009-09-13 23:34:49.000000000 +0000
+++ ./lightbox2.module 2010-01-27 10:23:07.000000000 +0000
@@ -242,6 +242,11 @@ function lightbox2_menu() {
* Implementation of hook_init().
*/
function lightbox2_init() {
+ // Insert support
+ if (module_exists('insert')) {
+ module_load_include('inc', 'lightbox2', 'lightbox2.insert');
+ }
+
if (lightbox2_exclude_these_paths() != 1) {
lightbox2_add_files();
}
@@ -895,6 +900,15 @@ function lightbox2_theme() {
}
}
+ // Additional Insert theme functions.
+ if (module_exists('insert')) {
+ // Theme functions in lightbox2.insert.inc.
+ $theme['lightbox2_insert_image'] = array(
+ 'arguments' => array('item' => NULL, 'widget' => NULL, 'type' => NULL, 'image_preset_name' => NULL, 'link_preset_name' => NULL),
+ 'template' => 'lightbox2.insert-image',
+ );
+ }
+
return $theme;
}