Fix for Views Handler, Make it not look for field in database

  1. <?php
  2. // $Id: $
  3. /**
  4.  * @file
  5.  * lightbox2.views.inc
  6.  */
  7.  
  8. /**
  9.  * Implementation of hook_views_data()
  10.  */
  11. function lightbox2_views_data() {
  12.  
  13.   $data['lightbox2']['table']['group'] = t('Lightbox');
  14.  
  15.   $data['lightbox2']['table']['join'] = array(
  16.     '#global' => array(),
  17.   );
  18.  
  19.   $data['lightbox2']['lightbox2'] = array(
  20.     'group' => t('Lightbox'),
  21.     'field' => array(
  22.       'title' => t('Lightbox trigger'),
  23.       'help' => t('Provide custom text or link.'),
  24.       'handler' => 'lightbox2_handler_field_lightbox2',
  25.     ),
  26.   );
  27.  
  28.   return $data;
  29. }
  30.  
  31. /**
  32.  * Implementation of hook_views_handlers() to register all of the basic handlers
  33.  * views uses.
  34.  */
  35. function lightbox2_views_handlers() {
  36.   return array(
  37.     'info' => array(
  38.       'path' => drupal_get_path('module', 'lightbox2'),
  39.     ),
  40.     'handlers' => array(
  41.       'lightbox2_handler_field_lightbox2' => array(
  42.         'parent' => 'views_handler_field',
  43.       ),
  44.     ),
  45.   );
  46. }
  47. ?>
  48.  
  49. This is the error I'm getting in the Live Preview:
  50.  
  51. user warning: Unknown column 'lightbox2' in 'field list' query: SELECT node.nid AS nid, node.title AS node_title, node_data_field_textbody.field_textbody_value AS node_data_field_textbody_field_textbody_value, node_data_field_textbody.field_textbody_format AS node_data_field_textbody_field_textbody_format, node.type AS node_type, node.vid AS node_vid, lightbox2 FROM node node LEFT JOIN content_type_lighboxtest node_data_field_textbody ON node.vid = node_data_field_textbody.vid WHERE (node.status <> 0) AND (node.type in ('lighboxtest')) LIMIT 0, 10 in /shared/vash/sandboxes/brand/play/site/www/profiles/palantirprofile/modules/views/includes/view.inc on line 731.

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.