function _content_admin_field_add_existing in Content Construction Kit (CCK) 5
Same name and namespace in other branches
- 6 includes/content.admin.inc \_content_admin_field_add_existing()
2 string references to '_content_admin_field_add_existing'
- content_copy_import_form_submit in ./
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_admin_field_add in ./
content_admin.inc - Menu callback; presents the form for adding a new field.
File
- ./
content_admin.inc, line 468 - Administrative interface for content type creation.
Code
function _content_admin_field_add_existing($type_name) {
$output = '';
$type = content_types($type_name);
$fields = content_fields();
$form = array();
$options = array();
foreach ($fields as $field) {
if (!isset($type['fields'][$field['field_name']])) {
$options[$field['field_name']] = t($field['widget']['label']) . ' (' . $field['field_name'] . ')';
}
}
if ($options) {
$form['existing'] = array(
'#type' => 'fieldset',
'#title' => t('Add existing field'),
);
$form['existing']['field_name'] = array(
'#type' => 'select',
'#required' => TRUE,
'#options' => $options,
);
$form['existing']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add field'),
);
$form['existing']['type_name'] = array(
'#type' => 'value',
'#value' => $type_name,
);
}
return $form;
}