? fancybox-emvideo.patch
Index: fancybox.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fancybox/Attic/fancybox.module,v
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.3 fancybox.module
--- fancybox.module	15 Mar 2010 22:38:51 -0000	1.1.4.3
+++ fancybox.module	10 Apr 2010 12:19:48 -0000
@@ -86,7 +86,6 @@ function fancybox_menu() {
     'page arguments' => array('fancybox_admin_settings_form'),
     'type' => MENU_NORMAL_ITEM,
   );
-
   return $items;
 }
 
@@ -118,6 +117,15 @@ function fancybox_theme() {
       );
     }
   }
+  $theme['fancybox_formatter_emvideo_fancybox_video'] = array(
+    'arguments' => array('element' => NULL),
+    'file' => 'fancybox.theme.inc',
+  );
+  
+  $theme['fancybox_emvideo'] = array(
+    'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL),
+    'file' => 'fancybox.theme.inc',
+  );
 
   return $theme;
 }
@@ -510,10 +518,15 @@ function fancybox_field_formatter_info()
         'field types' => array('image', 'filefield'),
       );
     }
+    
+    $formatters = array_merge($presets);
+  }
 
-    if (is_array($presets)) {
-      $formatters = array_merge($presets);
-    }
+  if (module_exists('emfield') && module_exists('emvideo')) {
+    $formatters['emvideo_fancybox_video'] = array(
+      'label' => t('Fancybox: Image Thumbnail -> Full Size Video'),
+      'field types' => array('emvideo'),
+    );
   }
 
   return $formatters;
Index: fancybox.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fancybox/Attic/fancybox.theme.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fancybox.theme.inc
--- fancybox.theme.inc	14 Mar 2010 10:52:37 -0000	1.1.2.1
+++ fancybox.theme.inc	10 Apr 2010 12:19:48 -0000
@@ -43,3 +43,43 @@ function theme_imagefield_image_imagecac
     return l($image, $link_path, $options);
   }
 }
+
+/**
+ * Generate the HTML output to open a emvideo field in fancybox.
+ * Use the generic modal output from emvideo.
+ *
+ * Note: if you are implementing a custom AJAX callback make sure that 
+ * you wrap the output into a div where you set its dimensions, fancybox sometimes
+ * fails to detect the size of the embedded video if its wrapped into multiple divs.
+ *
+ * @param $field
+ *   The CCK field the action is being performed on.
+ * @param $item
+ *   An array, keyed by column, of the data stored for this item in this field.
+ * @param $formatter
+ *   The formatter to use for the field.
+ * @param $node
+ *   The node object.
+ * @return
+ *   Themed modal dialogue of the embedded media field video.
+ */
+function theme_fancybox_emvideo($field, $item, $formatter, $node) {
+  return theme('emvideo_modal_generic', $field, $item, $formatter, $node, array('modal' => 'fancybox'));
+}
+
+
+/**
+ * CCK formatter theme for the emfield. This will call theme_fancybox_emvideo.
+ *
+ * @param $element
+ *   The CCK field element.
+ * @return
+ *   HTML output for displaying the video and link.
+ */
+function theme_fancybox_formatter_emvideo_fancybox_video($element) {
+  $field = content_fields($element['#field_name'], $element['#type_name']);
+  $item = $element['#item'];
+  $formatter = "emvideo";
+  $node = node_load($element['#node']->nid);
+  return module_invoke('emfield', 'emfield_field_formatter', $field, $item, $formatter, $node, 'fancybox');
+}
Index: js/fancybox.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/fancybox/js/Attic/fancybox.js,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fancybox.js
--- js/fancybox.js	14 Mar 2010 10:52:37 -0000	1.1.2.1
+++ js/fancybox.js	10 Apr 2010 12:19:49 -0000
@@ -11,5 +11,7 @@ Drupal.behaviors.initFancybox = function
   }
 
   $('.imagefield-fancybox').fancybox(settings.options);
+  settings.options.hideOnContentClick = false;
+  $('.emvideo-modal-fancybox').fancybox(settings.options);
 
 }
