You are here

function units_unit_form_submit in Units of Measurement 7

Same name and namespace in other branches
  1. 7.2 units_ui.pages.inc \units_unit_form_submit()

Submit handler for 'units_unit_form'.

Save an entity of type 'units_unit'.

File

./units_ui.pages.inc, line 179
Menu page callbacks for Units UI module.

Code

function units_unit_form_submit($form, &$form_state) {
  $entity = entity_ui_form_submit_build_entity($form, $form_state);
  units_unit_save($entity);
  drupal_set_message(t('Unit %name has been successfully saved.', array(
    '%name' => entity_label('units_unit', $entity),
  )));

  // Taking user back to the overview page.
  $form_state['redirect'] = array(
    units_ui_overview_uri($entity),
  );
}