You are here

function multifield_edit_form_submit in Multifield 7

Same name and namespace in other branches
  1. 7.2 multifield.admin.inc \multifield_edit_form_submit()

File

./multifield.admin.inc, line 148
Administation pages and forms for the Multifield module.

Code

function multifield_edit_form_submit($form, &$form_state) {
  form_state_values_clean($form_state);
  $multifield = (object) $form_state['values'];
  $multifield->is_new = empty($multifield->mfid);
  multifield_save($multifield);
  watchdog('multifield', 'Saved multifield type %type.', array(
    '%type' => $multifield->label,
  ), WATCHDOG_INFO);
  if (!empty($multifield->is_new)) {
    if (module_exists('field_ui')) {
      $form_state['redirect'] = 'admin/structure/multifield/manage/' . $multifield->machine_name . '/fields';
    }
    else {
      drupal_set_message(t('The Field UI module must be enabled to add fields to the multifield.'));
      $form_state['redirect'] = 'admin/structure/multifield';
    }
  }
  else {
    $form_state['redirect'] = 'admin/structure/multifield';
  }
}