function content_field_instance_collapse in Content Construction Kit (CCK) 6.2
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 includes/content.crud.inc \content_field_instance_collapse()
Collapse field info from field => widget to flattened form values.
6 calls to content_field_instance_collapse()
- ContentCrudBasicTest::testBasic in tests/content.crud.test 
- content_copy_export in modules/content_copy/ content_copy.module 
- Process the export, get field admin forms for all requested fields and save the form values as formatted text.
- 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_basic_form_submit in includes/content.admin.inc 
- Create a new field for a content type.
- content_field_edit_form in includes/content.admin.inc 
- Menu callback; presents the field editing page.
File
- includes/content.crud.inc, line 146 
- 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;
}