You are here

function registration_type_form_submit in Entity Registration 7.2

Same name and namespace in other branches
  1. 8.2 includes/registration_type.admin.inc \registration_type_form_submit()
  2. 8 includes/registration_type.admin.inc \registration_type_form_submit()
  3. 7 includes/registration_type.admin.inc \registration_type_form_submit()

Form API submit callback for the type form.

File

includes/registration_type.admin.inc, line 223
Model type editing UI.

Code

function registration_type_form_submit(&$form, &$form_state) {

  // Set default state to NULL if 'none' is selected for database insert.
  if ($form_state['values']['default_state'] == 'none') {
    $form_state['values']['default_state'] = NULL;
  }
  $registration_type = entity_ui_form_submit_build_entity($form, $form_state);
  foreach (element_children($form['data']) as $data_property) {
    if (isset($registration_type->{$data_property})) {
      $registration_type->data[$data_property] = $registration_type->{$data_property};
      unset($registration_type->{$data_property});
    }
  }
  $registration_type
    ->save();
  menu_rebuild();
  $form_state['redirect'] = 'admin/structure/registration/registration_types';
}