function simple_access_group_form in Simple Access 5.2
Same name and namespace in other branches
- 5 simple_access.module \simple_access_group_form()
- 6.2 simple_access.admin.inc \simple_access_group_form()
- 7.2 simple_access.admin.inc \simple_access_group_form()
1 string reference to 'simple_access_group_form'
- simple_access_menu in ./
simple_access.module - Implementation of hook_menu().
File
- ./
simple_access.module, line 747 - This module allows administrators to make nodes viewable by specific 'access groups'. Each access group can contain any number of roles. If a node is not assigned to any access groups, it will remain viewable by all users.
Code
function simple_access_group_form($gid = NULL) {
if ($gid) {
drupal_set_title(t('Edit Access Group'));
$group = db_fetch_object(db_query('SELECT name, weight FROM {simple_access_groups} WHERE gid = %d', $gid));
$name = $group->name;
$weight = $group->weight;
$roles = simple_access_get_roles($gid);
$form['gid'] = array(
'#type' => 'hidden',
'#value' => $gid,
);
}
else {
drupal_set_title(t('Create Access Group'));
$weight = 0;
}
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#default_value' => $name,
'#size' => 40,
'#maxlength' => 80,
'#description' => t('The name for the access group as it will appear on the content editing form.'),
'#attributes' => $attributes = NULL,
'#required' => TRUE,
);
$form['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Roles'),
'#default_value' => $roles,
'#options' => user_roles(),
'#description' => t('Roles that can view'),
);
$form['weight'] = array(
'#type' => 'weight',
'#title' => 'Weight',
'#default_value' => $weight,
'#delta' => 10,
'#description' => t('When setting permissions, heavier names will sink and lighter names will be positioned nearer the top.'),
);
$form[] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}