You are here

function _content_admin_field_add_existing_submit in Content Construction Kit (CCK) 6

Same name and namespace in other branches
  1. 5 content_admin.inc \_content_admin_field_add_existing_submit()

Add an existing field to a content type.

File

includes/content.admin.inc, line 532
Administrative interface for content type creation.

Code

function _content_admin_field_add_existing_submit($form, &$form_state) {
  module_load_include('inc', 'content', 'includes/content.crud');
  $form_values = $form_state['values'];
  if (content_field_instance_create($form_values)) {
    drupal_set_message(t('Added field %label.', array(
      '%label' => $form_values['field_name'],
    )));
  }
  else {
    drupal_set_message(t('There was a problem adding 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';
}