You are here

function access_scheme_form_submit in Access Control Kit 7

Form submission handler for access_scheme_form().

See also

access_scheme_form()

access_scheme_form_validate()

File

./access_schemes.admin.inc, line 429
Access schemes administrative UI for the access control kit module.

Code

function access_scheme_form_submit($form, &$form_state) {

  // Save the scheme.
  $scheme = access_scheme_form_submit_build_scheme($form, $form_state);
  $status = access_scheme_save($scheme);

  // Report the change.
  $t_args = array(
    '%name' => $scheme->name,
  );
  switch ($status) {
    case SAVED_NEW:
      drupal_set_message(t('Added access scheme %name.', $t_args));

      // New schemes redirect to the edit page to configure handlers.
      $form_state['redirect'] = 'admin/structure/access/' . str_replace('_', '-', $scheme->machine_name);
      break;
    case SAVED_UPDATED:
      drupal_set_message(t('Updated access scheme %name.', $t_args));

      // Updated schemes redirect to the admin overview.
      $form_state['redirect'] = 'admin/structure/access';
      break;
  }
  watchdog('access', 'Saved access scheme %name.', $t_args, WATCHDOG_NOTICE, l(t('edit'), 'admin/structure/access/' . str_replace('_', '-', $scheme->machine_name)));

  // Rebuild the menu so that the "add access grant" page is up to date.
  menu_rebuild();
}