You are here

function redhen_org_org_form_submit in RedHen CRM 7

Submit callback for redhen_org_org_form().

File

modules/redhen_org/includes/redhen_org.forms.inc, line 63
Forms for creating, editing, and deleting organizations.

Code

function redhen_org_org_form_submit($form, &$form_state) {
  $org =& $form_state['redhen_org'];

  // Set the org's author uid.
  global $user;
  $org->author_uid = $user->uid;

  // Save default parameters back into the $org object.
  $org->label = $form_state['values']['label'];

  // Notify field widgets.
  field_attach_submit('redhen_org', $org, $form, $form_state);

  // Save the organization.
  $org
    ->save();
  drupal_set_message(t('Organization %label saved.', array(
    '%label' => $org->label,
  )));
  $form_state['redirect'] = 'redhen/org/' . $org
    ->internalIdentifier();
}