geo/modules/geo_field/geo_field.module, line 349
- Versions
- 6
_geo_field_init(&$field)
Code
<?php
function _geo_field_init(&$field) {
// We've already molested CCK's table, nothing to see here.
if ($field['geo_enabled']) return;
// Ignore fields that are still in infancy.
if (!isset($field['field_name'])) return;
$table = _geo_field_tablename($field);
// CCK hasn't created our table yet. Try again next time.
if (!db_table_exists($table)) return;
$column = $field['field_name'] .'_geo';
// Reuse the original column definition, but set a different datatype.
$spec = $field['columns']['geo'];
$spec['type'] = $field['geo_type'];
$spec['srid'] = $field['srid'] ? $field['srid'] : GEO_SRID_DEFAULT;;
$ret = array();
db_drop_field($ret, $table, $column);
if ($field['geo_enabled'] = geo('add_field', $ret, $table, $column, $spec)) {
// Re-save the field to ensure that geo_enabled gets set.
module_load_include('inc', 'content', 'includes/content.crud');
_content_field_write($field, 'update');
content_clear_type_cache();
}
}
?> 