You are here

function config_perms_admin_form_submit in Custom Permissions 6.2

Same name and namespace in other branches
  1. 7.2 config_perms.admin.inc \config_perms_admin_form_submit()

Submit handler.

File

./config_perms.admin.inc, line 147
Admin pages

Code

function config_perms_admin_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  foreach ($values['local'] as $key => $data) {
    if ($data['remove'] && !empty($data['pid'])) {

      // Delete

      //db_query("DELETE FROM {config_perms} WHERE id = '%s'", $data['pid']);
      config_perms_delete((object) $data);
    }
    elseif (!empty($data['name']) && !empty($data['path'])) {

      // Update || Insert
      $data['path'] = config_perms_parse_path($data['path']);
      config_perms_save((object) $data);
    }
  }

  // Rebuild menu and cache
  config_perms_cache_rebuild();
  menu_rebuild();
  drupal_set_message(t('The permissions have been saved.'));
}