function access_grant_delete_confirm in Access Control Kit 7
Form constructor for the access grant delete confirmation form.
See also
access_grant_delete_confirm_submit()
1 string reference to 'access_grant_delete_confirm'
- access_menu in ./
access.module - Implements hook_menu().
File
- ./
access_grants.admin.inc, line 683 - Access grants administrative UI for the access control kit module.
Code
function access_grant_delete_confirm($form, &$form_state, $grant) {
$form_state['grant'] = $grant;
$account = user_load($grant->uid);
$role = user_role_load($grant->rid);
$scheme = access_scheme_machine_name_load($grant->scheme);
$t_args = array(
'%user' => format_username($account),
'%role' => $role->name,
'%scheme' => $scheme->name,
);
$message = t("Are you sure you want to revoke all %scheme for %user's access as %role?", $t_args);
$caption = '<p>' . t('This action cannot be undone.') . '</p>';
// If this is the user's last grant for this role, allow administrators to
// also revoke the role itself at the same time.
$existing = access_grant_load_by_condition(array(
'uid' => $grant->uid,
'rid' => $grant->rid,
));
if (count($existing) == 1) {
$form['revoke_role'] = array(
'#type' => 'checkbox',
'#title' => t("Also revoke %user's membership in the %role role?", $t_args),
'#description' => t("This is %user's last remaining access grant for the %role role. By checking this box, %user will be removed from the %role role entirely.", $t_args),
'#access' => user_access('administer users'),
);
}
return confirm_form($form, $message, 'admin/access/grant/' . $grant->gid, $caption, t('Delete'));
}