function _data_ui_changed in Data 6
Same name and namespace in other branches
- 7 data_ui/data_ui.admin.inc \_data_ui_changed()
Magic helper function. Detect changed between keys in $new and $field and return a new field spec based on $field IF there are differences.
Otherwise return FALSE.
Currently checked: type, unsigned, default.
@todo This is insane, we need to use clean specs instead of converting existing specs. This will require us also to not allow changes to indexes, PKs and field specs on the same form.
1 call to _data_ui_changed()
- data_ui_edit_form_submit in data_ui/
data_ui.admin.inc - Submit form.
File
- data_ui/
data_ui.admin.inc, line 977 - Admin UI functions.
Code
function _data_ui_changed($new, $field) {
$changed = FALSE;
if ($field['type'] != $new['type']) {
$field['type'] = $new['type'];
$changed = TRUE;
}
if ($field['unsigned'] != $new['unsigned']) {
$field['unsigned'] = $new['unsigned'];
$changed = TRUE;
}
if ($changed) {
if ($field['type'] == 'text') {
unset($field['default']);
}
return $field;
}
return FALSE;
}