? emvideo_lightbox2_link.patch
Index: contrib/emvideo/emvideo.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.module,v
retrieving revision 1.1.2.30.2.1
diff -u -p -r1.1.2.30.2.1 emvideo.module
--- contrib/emvideo/emvideo.module	8 Dec 2009 21:19:20 -0000	1.1.2.30.2.1
+++ contrib/emvideo/emvideo.module	4 Feb 2010 17:45:50 -0000
@@ -108,6 +108,10 @@ function emvideo_theme() {
         'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
         'file' => 'emvideo.theme.inc'
     ),
+    'emvideo_lightbox2_link' => array(
+        'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
+        'file' => 'emvideo.theme.inc'
+    ),
     'emvideo_shadowbox' => array(
         'arguments' => array('field' => NULL, 'item' => NULL, 'formatter' => NULL, 'node' => NULL, 'options' => array()),
         'file' => 'emvideo.theme.inc'
@@ -160,6 +164,10 @@ function emvideo_theme() {
         'arguments' => array('element' => NULL),
         'file' => 'emvideo.theme.inc'
     ),
+    'emvideo_formatter_lightbox2_link' => array(
+    'arguments' => array('element' => NULL),
+    'file' => 'emvideo.theme.inc'
+    ),
     'emvideo_formatter_shadowbox' => array(
         'arguments' => array('element' => NULL),
         'file' => 'emvideo.theme.inc'
@@ -349,6 +357,10 @@ function emvideo_field_formatter_info() 
       'label' => t('Lightbox2: Image Thumbnail -> Full Size Video'),
       'field types' => $types,
     );
+    $formats['lightbox2_link'] = array(
+      'label' => t('Lightbox2: Node Title -> Full Size Video'),
+      'field types' => $types,
+    );
   }
   if (module_exists('shadowbox')) {
     $formats['shadowbox'] = array(
Index: contrib/emvideo/emvideo.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/emfield/contrib/emvideo/Attic/emvideo.theme.inc,v
retrieving revision 1.1.2.38
diff -u -p -r1.1.2.38 emvideo.theme.inc
--- contrib/emvideo/emvideo.theme.inc	21 Oct 2009 16:12:36 -0000	1.1.2.38
+++ contrib/emvideo/emvideo.theme.inc	4 Feb 2010 17:45:50 -0000
@@ -105,7 +105,7 @@ function theme_emvideo_video_thumbnail($
   $link_url = isset($options['link_url']) ? $options['link_url'] : 'node/'. $node->nid;
 
   // Define the title/alt to display for the link hover.
-  $link_title = isset($options['link_title']) ? $options['link_title'] : (isset($options['title']) ? $options['title'] : (isset($field['widget']['thumbnail_link_title']) ? $field['widget']['thumbnail_link_title'] : variable_get('emvideo_default_thumbnail_link_title', t('See video'))));
+  $link_title = isset($options['link_title']) ? $options['link_title'] : (isset($options['title']) ? $options['title'] : (isset($field['widget']['thumbnail_link_title']) ? $field['widget']['thumbnail_link_title'] : variable_get('emvideo_default_thumbnail_path_title', t('See video'))));
   if (module_exists('token')) {
     // Allow the editor to use [title] tokens.
     $link_title = token_replace($link_title, 'global', $node);
@@ -212,7 +212,7 @@ function theme_emvideo_modal_generic($fi
     'absolute' => FALSE,
     'html' => TRUE,
   );
-  if ($options['modal'] == 'lightbox2') {
+  if ($options['modal'] == 'lightbox2' || $options['modal'] == 'lightbox2_link') {
     $attributes['attributes']['rel'] = 'lightframe['. $field['type_name'] .'|width:'. ($width + 16) .'; height:'. ($height + 16) .';]';
   }
   else if ($options['modal'] == 'shadowbox') {
@@ -221,7 +221,7 @@ function theme_emvideo_modal_generic($fi
     $destination .= '/index.php';
   }
 
-  if (($options['modal'] == 'lightbox2') && function_exists('lightbox2_add_files')) {
+  if (($options['modal'] == 'lightbox2' || $options['modal'] == 'lightbox2_link') && function_exists('lightbox2_add_files')) {
     lightbox2_add_files();
   }
 
@@ -237,7 +237,13 @@ function theme_emvideo_modal_generic($fi
   if ($options['wrapper-class']) {
     $class .= ' '. $options['wrapper-class'];
   }
-  $output = '<div class="'. $class .'">'. l($thumbnail, $destination, $attributes) .'</div>';
+  if (strpos($options['modal'], '_link')) {
+    $attributes['html'] = FALSE;
+    $output = '<div class="'. $class .'">'. l(_emvideo_titles($node->nid), $destination, $attributes) .'</div>';    
+  }
+  else {
+    $output = '<div class="'. $class .'">'. l($thumbnail, $destination, $attributes) .'</div>';    
+  }
   return $output;
 }
 
@@ -258,6 +264,14 @@ function theme_emvideo_lightbox2($field,
 }
 
 /**
+ *  Display the video as a Lightbox2 modal popup from a link. Requires the Lightbox2 module.
+ */
+function theme_emvideo_lightbox2_link($field, $item, $formatter, $node, $options = array()) {
+  $options['modal'] = 'lightbox2_link';
+  return theme('emvideo_modal_generic', $field, $item, $formatter, $node, $options);
+}
+
+/**
  *  Display the video as a Shadowbox modal popup. Requires the Shadowbox module.
  */
 function theme_emvideo_shadowbox($field, $item, $formatter, $node, $options = array()) {
@@ -316,6 +330,9 @@ function theme_emvideo_formatter_thickbo
 function theme_emvideo_formatter_lightbox2($element) {
   return _emvideo_formatter_theme_helper($element);
 }
+function theme_emvideo_formatter_lightbox2_link($element) {
+  return _emvideo_formatter_theme_helper($element);
+}
 function theme_emvideo_formatter_shadowbox($element) {
   return _emvideo_formatter_theme_helper($element);
 }
@@ -341,6 +358,20 @@ function _emvideo_formatter_theme_helper
 }
 
 /**
+ * Helper function for link formatters.
+ *
+ * Store node titles collected in the curent request.
+ */
+function _emvideo_titles($nid) {
+  static $titles = array();
+  if (!isset($titles[$nid])) {
+    $title = db_result(db_query("SELECT title FROM {node} WHERE nid=%d", $nid));
+    $titles[$nid] = $title ? $title : '';
+  }
+  return $titles[$nid];
+}
+
+/**
  * Convert time from field into seconds.
  *
  * @param $time
