function config_perms_ahah in Custom Permissions 6.2
Interface for the AHAH management.
1 string reference to 'config_perms_ahah'
- config_perms_menu in ./
config_perms.module - Implementation of hook_menu().
File
- ./
config_perms.admin.inc, line 93 - Admin pages
Code
function config_perms_ahah() {
// Load the form from cache
$cache = cache_get('form_' . $_POST['form_build_id'], 'cache_form');
$form = $cache->data;
$form_state = array(
'values' => $_POST,
);
$tags = array();
$check = array();
$newest = count($_POST['local']);
foreach ($_POST['local'] as $key => $data) {
if (is_numeric($key)) {
$perm = new stdClass();
$perm->pid = check_plain($data['pid']);
$perm->machine_name = check_plain($data['machine_name']);
$perm->name = check_plain($data['name']);
$perm->path = config_perms_parse_path(check_plain($data['path']));
$perm->status = $key == $newest - 1 ? 1 : (int) isset($data['status']);
$perm->remove = (int) isset($data['remove']);
$perms[] = $perm;
unset($cache->data['perms']['local'][$key]);
}
}
$form = _config_perms_form($perms);
$cache->data['perms']['local'] = array_merge($cache->data['perms']['local'], $form);
cache_set('form_' . $_POST['form_build_id'], $cache->data, 'cache_form', $cache->expire);
$form = $cache->data['perms'];
$form += array(
'#post' => $_POST,
'#programmed' => FALSE,
'#tree' => FALSE,
'#parents' => array(),
);
drupal_alter('form', $form, array(), 'config_perms_ahah');
$form_state['submitted'] = FALSE;
$form = form_builder('config_perms_ahah', $form, $form_state);
$output = theme('status_messages') . drupal_render($form['local']);
print drupal_to_js(array(
'status' => TRUE,
'data' => $output,
));
// Kill Devel if it's installed
$GLOBALS['devel_shutdown'] = TRUE;
exit;
}