/[drupal]/contributions/modules/geo/modules/geo_data/geo_data.module
ViewVC logotype

Diff of /contributions/modules/geo/modules/geo_data/geo_data.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15 by vauxia, Thu Nov 12 18:06:45 2009 UTC revision 1.16 by vauxia, Mon Nov 23 23:30:26 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: geo_data.module,v 1.14 2009/11/09 17:44:40 vauxia Exp $  // $Id: geo_data.module,v 1.15 2009/11/12 18:06:45 vauxia Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 226  function geo_data_field($op, &$node, $fi Line 226  function geo_data_field($op, &$node, $fi
226    
227      case 'validate':      case 'validate':
228        return;        return;
   
     case 'sanitize':  
       geo_set_pre_render($node->content);  
       return;  
229    }    }
230  }  }
231    
232  /**  /**
233     * Implementation of hook_content_is_empty().
234     */
235    function geo_data_content_is_empty($item, $field) {
236      return empty($item['value']);
237    }
238    
239    /**
240   * Implementation of hook_widget_info().   * Implementation of hook_widget_info().
241   */   */
242  function geo_data_widget_info() {  function geo_data_widget_info() {
# Line 274  function geo_data_select_process($elemen Line 277  function geo_data_select_process($elemen
277    return $element;    return $element;
278  }  }
279    
 function theme_geo_data_select($element) {  
   return $element['#children'];  
 }  
   
 function geo_data_content_is_empty($item, $field) {  
   return empty($item['value']);  
 }  
   
280  function geo_data_allowed_values($field) {  function geo_data_allowed_values($field) {
281    $options = array('' => t('Please select'));    $options = array('' => t('Please select'));
282    $table = $field['geo_data_table'];    $table = $field['geo_data_table'];
# Line 324  function geo_data_field_formatter_info() Line 319  function geo_data_field_formatter_info()
319  }  }
320    
321  /**  /**
322   * Implementation of hook_theme().   * API function: Load a geo_data source.
323   */   */
324  function geo_data_theme() {  function geo_data_load($data) {
325    return array(    module_load_include('inc', 'geo_data', 'includes/geo_data');
326      'geo_data_formatter_default' => array('element' => NULL),    if (isset($data->data)) {
327      'geo_data_formatter_key' => array('element' => NULL),      foreach (unserialize($data->data) as $key => $val) {
328      'geo_data_select' => array( 'arguments' => array('element' => NULL) ),        $data->$key = $val;
329    );      }
330        unset($data->$data);
331      }
332      $data = New geo_data_table($data);
333      return $data;
334  }  }
335    
336  /**  /**
337   * Default field theme function: return value field.   * API function: List geo_data sources.
338   */   */
339  function theme_geo_data_formatter_default($element) {  function geo_data_list($reset = FALSE) {
340    return check_plain($element['#item']['label']);    static $list;
341      if ($reset || !isset($list)) {
342        $list = array();
343        $res = db_query("SELECT * FROM {geo_data} ORDER BY title");
344        while ($row = db_fetch_object($res)) {
345          $list[$row->gdid] = geo_data_load($row);
346        }
347      }
348      return $list;
349  }  }
350    
351  /**  /**
352   * Default field theme function: return key field.   * Implementation of hook_theme().
353   */   */
354  function theme_geo_data_formatter_key($element) {  function geo_data_theme() {
355    return check_plain($element['#item']['value']);    module_load_include('theme.inc', 'geo_data', 'theme/geo_data');
356      return geo_data_theme_theme();
357  }  }
358    
359  /**  /**
# Line 357  function geo_data_views_api() { Line 365  function geo_data_views_api() {
365      'path' => drupal_get_path('module', 'geo_data') .'/includes/views',      'path' => drupal_get_path('module', 'geo_data') .'/includes/views',
366    );    );
367  }  }
   

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.3