function content_field_instance_collapse in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 5 content_crud.inc \content_field_instance_collapse()
- 6.3 includes/content.crud.inc \content_field_instance_collapse()
- 6.2 includes/content.crud.inc \content_field_instance_collapse()
Collapse field info from field => widget to flattened form values.
3 calls to content_field_instance_collapse()
- content_admin_display_overview_form_submit in includes/
content.admin.inc - Submit handler for the display overview form.
- content_copy_import_form_submit in modules/
content_copy/ content_copy.module - Submit handler for import form. For each submitted field: 1) add new field to the database 2) execute the imported field macro to update the settings to the imported values
- _content_field_instance_write in includes/
content.crud.inc - Write a field instance record.
File
- includes/
content.crud.inc, line 145 - Create/Read/Update/Delete functions for CCK-defined object types.
Code
function content_field_instance_collapse($field) {
if (!isset($field['widget'])) {
return $field;
}
$field['widget_settings'] = !empty($field['widget']) ? $field['widget'] : array();
$field['widget_type'] = !empty($field['widget']['type']) ? $field['widget']['type'] : '';
$field['weight'] = !empty($field['widget']['weight']) ? $field['widget']['weight'] : 0;
$field['label'] = !empty($field['widget']['label']) ? $field['widget']['label'] : $field['field_name'];
$field['description'] = !empty($field['widget']['description']) ? $field['widget']['description'] : '';
$field['type_name'] = !empty($field['type_name']) ? $field['type_name'] : '';
if (!empty($field['widget']['module'])) {
$widget_module = $field['widget']['module'];
}
elseif (!empty($field['widget']['type'])) {
$widget_types = _content_widget_types();
$widget_module = $widget_types[$field['widget']['type']]['module'];
}
else {
$widget_module = '';
}
$field['widget_module'] = $widget_module;
unset($field['widget_settings']['type']);
unset($field['widget_settings']['weight']);
unset($field['widget_settings']['label']);
unset($field['widget_settings']['description']);
unset($field['widget_settings']['module']);
unset($field['widget']);
return $field;
}