function data_build_field_definition in Data 8
Same name and namespace in other branches
- 6 data.module \data_build_field_definition()
- 7 data.module \data_build_field_definition()
Build a full schema api field definition.
Parameters
$stub: Array with at least one key 'type'.
File
- ./
data.module, line 277 - Hooks and API functions for data module.
Code
function data_build_field_definition($stub) {
$spec = array();
$spec['type'] = $stub['type'];
$spec['size'] = empty($stub['size']) ? 'normal' : $stub['size'];
if ($spec['type'] == 'int') {
$spec['unsigned'] = empty($stub['unsigned']) ? FALSE : TRUE;
}
if ($spec['type'] == 'varchar') {
$spec['length'] = 255;
unset($spec['size']);
}
if ($spec['type'] == 'geometry') {
$spec['mysql_type'] = 'geometry';
$spec['pgsql_type'] = 'GEOMETRY';
}
return $spec;
}