function _content_admin_field_add_existing in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 5 content_admin.inc \_content_admin_field_add_existing()
1 string reference to '_content_admin_field_add_existing'
- _content_admin_field_add in includes/
content.admin.inc - Menu callback; presents the form for adding a new field.
File
- includes/
content.admin.inc, line 426 - Administrative interface for content type creation.
Code
function _content_admin_field_add_existing(&$form_state, $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;
}