You are here

function party_hat_form_submit in Party 7

Same name and namespace in other branches
  1. 8.2 modules/party_hat/party_hat.admin.inc \party_hat_form_submit()

Form submission for the hat edit form.

File

modules/party_hat/party_hat.admin.inc, line 169
Contains admin page callbacks for the party hats module.

Code

function party_hat_form_submit($form, &$form_state) {

  // Build the entity and save it.
  $hat = entity_ui_form_submit_build_entity($form, $form_state);

  // Set the data set rules in the hat.
  party_hat_set_data_set_rules($hat, $form_state['values']['data_set_rules']);
  party_hat_save($hat);
  field_attach_submit('party_hat', $hat, $form, $form_state);
  drupal_set_message(t("Party hat has been saved."));

  // If editing an existing hat, redirect to the hat admin page.
  if ($form_state['build_info']['args'][1] == 'edit') {
    $form_state['redirect'] = 'admin/community/hats';
  }
}