Index: lightbox2.module
===================================================================
--- lightbox2.module	(revision 153)
+++ lightbox2.module	(working copy)
@@ -1362,3 +1362,12 @@
     }
   }
 }
+
+/**
+ * Implementation of hook_views_api().
+ */
+function lightbox2_views_api() {
+  return array(
+    'api' => '2.0',
+  );
+}
Index: lightbox2_handler_field_lightbox2.inc
===================================================================
--- lightbox2_handler_field_lightbox2.inc	(revision 0)
+++ lightbox2_handler_field_lightbox2.inc	(revision 0)
@@ -0,0 +1,102 @@
+<?php
+// $Id: $
+
+/**
+ * @file
+ *
+ *
+ * This module is for Drupal 6.x only.
+ */
+
+
+/**
+ * A handler to provide a field that is completely custom by the administrator.
+ *
+ * @ingroup views_field_handlers
+ */
+class lightbox2_handler_field_lightbox2 extends views_handler_field {
+  function query() {
+    // do nothing -- to override the parent query.
+  }
+
+  function option_definition() {
+    $options = parent::option_definition();
+
+    // Override the alter text option to always alter the text.
+    //$options['alter']['contains']['alter_text'] = array('default' => TRUE);
+    return $options;
+  }
+
+  //Don't hardcode lightbox2
+  function options_form(&$form, &$form_state) {
+    parent::options_form($form, $form_state);
+    $fields = array('trigger_field' => t('<None>'));
+    foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
+      if($field != 'lightbox2'){
+        $fields[$field] = $field;
+      }
+    }
+
+    $form['trigger_field'] = array(
+      '#type' => 'select',
+      '#title' => t('Trigger field'),
+      '#description' => t('Select the field that should be turned into the trigger for the lightbox.'),
+      '#options' => $fields,
+      '#default_value' => $this->options['trigger_field'],
+      '#weight' => -10,
+    );
+
+    $form['popup'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Popup'),
+      '#description' => t('Combine tokens from the "Replacement patterns" below and html to create what the lightbox popup will become.'),
+      '#default_value' => $this->options['popup'],
+      '#weight' => -9,
+    );
+
+
+    // Remove the checkbox
+    unset($form['alter']['alter_text']);
+    unset($form['alter']['make_link']);
+    unset($form['alter']['text']);
+    unset($form['alter']['path']);
+    unset($form['alter']['alt']);
+    unset($form['alter']['prefix']);
+    unset($form['alter']['suffix']);
+    unset($form['alter']['text']['#dependency']);
+    unset($form['alter']['text']['#process']);
+  }
+
+  /**
+   * Render the trigger field and its linked popup information.
+   *
+   * TODO: Need to separate out the tokens to show in different lightboxes with different divs.
+   *       It will either need a next button in the lightmodal or multiple links.
+   */
+  function render($values) {
+    // Because in most cases
+    static $i = 0;
+
+    if (!empty($this->options['trigger_field'])) {
+
+      //Get the path name.
+      $path = isset($_GET['q']) ? $_GET['q'] : '<front>';
+      $link = url($path, array('absolute' => TRUE));
+
+      //Get the token information and generate the value for the popup.
+      $tokens = $this->get_render_tokens();
+      $popup = filter_xss_admin($this->options['popup']);
+      $popup = strtr($popup, $tokens);
+
+      $i++;
+
+      //The outside div is there to hide all of the divs because if the specific lightbox
+      //div is hidden it won't show up as a lightbox.
+      return "<a href='$link #lightbox-popup-{$i}'  rel='lightmodal'>". $tokens["[{$this->options['trigger_field']}]"] ."</a>
+                <div style='display: none;'><div id='lightbox-popup-{$i}'>$popup</div></div>";
+    }
+    else {
+      return;
+    }
+  }
+}

Property changes on: lightbox2_handler_field_lightbox2.inc
___________________________________________________________________
Added: svn:executable
   + *

Index: lightbox2.views.inc
===================================================================
--- lightbox2.views.inc	(revision 0)
+++ lightbox2.views.inc	(revision 0)
@@ -0,0 +1,46 @@
+<?php
+// $Id: $
+/**
+ * @file
+ * lightbox2.views.inc
+ */
+
+/**
+ * Implementation of hook_views_data()
+ */
+function lightbox2_views_data() {
+
+  $data['lightbox2']['table']['group'] = t('Lightbox');
+
+  $data['lightbox2']['table']['join'] = array(
+    '#global' => array(),
+  );
+
+  $data['lightbox2']['lightbox2'] = array(
+    'group' => t('Lightbox'),
+    'field' => array(
+      'title' => t('Lightbox trigger'),
+      'help' => t('Provide custom text or link.'),
+      'handler' => 'lightbox2_handler_field_lightbox2',
+    ),
+  );
+
+  return $data;
+}
+
+/**
+ * Implementation of hook_views_handlers() to register all of the basic handlers
+ * views uses.
+ */
+function lightbox2_views_handlers() {
+  return array(
+    'info' => array(
+      'path' => drupal_get_path('module', 'lightbox2'),
+    ),
+    'handlers' => array(
+      'lightbox2_handler_field_lightbox2' => array(
+        'parent' => 'views_handler_field',
+      ),
+    ),
+  );
+}
