You are here

function config_perms_admin_form_submit in Custom Permissions 7.2

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

Submit handler.

File

./config_perms.admin.inc, line 192
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
      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.'));
}