You are here

function context_ui_form_submit in Context 6

Same name in this branch
  1. 6 context_ui/context_ui.admin.inc \context_ui_form_submit()
  2. 6 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()
Same name and namespace in other branches
  1. 5 context_ui/context_ui_admin.inc \context_ui_form_submit()
  2. 6.3 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()
  3. 6.2 context_ui/context_ui.admin.inc \context_ui_form_submit()
  4. 7.3 context_ui/export_ui/context_export_ui.class.php \context_ui_form_submit()

Submit handler for main context_ui form.

1 string reference to 'context_ui_form_submit'
context.inc in context_ui/export_ui/context.inc

File

context_ui/context_ui.admin.inc, line 906

Code

function context_ui_form_submit($form, &$form_state) {
  switch ($form_state['clicked_button']['#id']) {

    // Send user to delete confirmation page
    case 'edit-delete':
      $form_state['redirect'] = 'admin/build/context/' . $form_state['values']['cid'] . '/delete';
      return;

    // Process form values and save and/or update the context in the db
    case 'edit-submit':
      $context = context_ui_form_process($form_state['values']);
      $result = context_save_context($context);
      if ($result) {
        drupal_set_message(t('The context %title was saved successfully.', array(
          '%title' => $context->value,
        )));
      }
      else {
        drupal_set_message(t('An error occurred while attempting to save your context information.'), 'error');
      }
      break;
  }
  $form_state['redirect'] = 'admin/build/context';
}