function _content_admin_field_add_new_submit in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 5 content_admin.inc \_content_admin_field_add_new_submit()
Create a new field for a content type.
File
- includes/
content.admin.inc, line 571 - Administrative interface for content type creation.
Code
function _content_admin_field_add_new_submit($form, &$form_state) {
module_load_include('inc', 'content', 'includes/content.crud');
$form_values = $form_state['values'];
$field_widget_type = explode('-', $form_values['field_widget_type']);
$form_values['type'] = $field_widget_type[0];
$form_values['widget_type'] = $field_widget_type[1];
unset($form_values['field_widget_type']);
if (content_field_instance_create($form_values)) {
drupal_set_message(t('Created field %label.', array(
'%label' => $form_values['field_name'],
)));
}
else {
drupal_set_message(t('There was a problem creating field %label.', array(
'%label' => $form_values['field_name'],
)));
}
$type = content_types($form_values['type_name']);
$form_state['redirect'] = 'admin/content/node-type/' . $type['url_str'] . '/fields/' . $form_values['field_name'];
}