I'm working to deprecate the use of hook_widget, hook_widget_info, etc. as it pertains to geo data. Why?! Two reasons:
1. Widgets are specific to CCK fields. This makes sense in most cases, but there are a lot of other places that can/should allow users to input data that is translated to GIS values. Most notably, views filters!
2. We need some place to express the expected input/output formats so that the values that a user has entered are correctly translated to the values that the receiving code is expecting -- without a lot of mucking around on the part of the frontend code. You (the GMAP+Geo maintainer) should be able to assert that you want to express your input/output in "array" format, the field module may wish to use WKB, and a particular views filter may require WKT.
These issues shouldn't be your problem, so Geo takes on the complexities of widgets and views inputs, while this module need only implement the following hook:
/**
* Implementation of hook_gis_input_info().
*/
function gmap_geo_gis_input_info($gis_type = NULL) {
$inputs = array(
'gmap_geo_picker' => array(
'label' => t('GMap picker'),
'gis input' => 'array', // the format you work with ( e.g. lat/lon array)
'safe reverse' => TRUE, // Whether or not a stored value will consistently translate to a value you expect
'gis types' => array('point'), // The geo types you're willing to work with.
'element' => array(
'#type' => 'gmap_geo_picker',
// You can put whatever else you want in the element here
),
),
);
return $inputs;
}
There are other examples of this hook in geo.module and geocode.module.
| Comment | File | Size | Author |
|---|---|---|---|
| gmap_geo_gis_input.patch | 1.96 KB | allie micka |
Comments
Comment #1
becw commentedpatch committed in http://drupal.org/cvs?commit=227176