function content_copy_fields in Content Construction Kit (CCK) 5
Same name and namespace in other branches
- 6.3 modules/content_copy/content_copy.module \content_copy_fields()
- 6 modules/content_copy/content_copy.module \content_copy_fields()
- 6.2 modules/content_copy/content_copy.module \content_copy_fields()
Get all the fields for a content type.
1 call to content_copy_fields()
- content_copy_export_form in ./
content_copy.module - A form to export field definitions.
File
- ./
content_copy.module, line 534 - Adds capability to import/export cck field data definitions.
Code
function content_copy_fields($type_name) {
$fields = array();
if (!$type_name) {
return $fields;
}
$content_info = _content_type_info();
foreach ($content_info['content types'][$type_name]['fields'] as $field_name => $field) {
// Omit fields from the export if their module is not currently installed
// otherwise the system will generate errors when the macro tries to execute their forms.
$field_types = _content_field_types();
$field_module = $field_types[$field['type']]['module'];
$widget_types = _content_widget_types();
$widget_module = $widget_types[$field['widget']['type']]['module'];
if (!empty($field_module) && module_exists($field_module) && !empty($widget_module) && module_exists($widget_module)) {
$fields[$field_name] = $field['widget']['label'] . ' (' . $field['field_name'] . ')';
}
}
return $fields;
}