function permissions_lock_settings_form in Permissions Lock 7
Settings form to control which permissions and / or roles have to be locked
1 string reference to 'permissions_lock_settings_form'
- permissions_lock_menu in ./
permissions_lock.module - Implements hook_menu().
File
- ./
permissions_lock.module, line 253 - Lock permissions on the permissions administration pages for certain roles
Code
function permissions_lock_settings_form($form, &$form_state) {
$form = array();
$form['permissions_lock_permissions'] = array(
'#type' => 'fieldset',
'#title' => t('Permissions'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['permissions_lock_permissions']['permissions_lock_locked_perm'] = array(
'#type' => 'checkboxes',
'#title' => t('Locked permissions'),
'#description' => t("Specify which permissions will not be changeable by users without the 'manage permissions unrestricted' permission"),
"#default_value" => permissions_lock_get_locked_permissions(),
"#options" => _permissions_lock_get_available_permissions(),
);
$hook_locks = permissions_lock_get_hook_data('permission');
if ($hook_locks) {
$form['permissions_lock_permissions']['permissions_lock_hook_locks'] = array(
'#type' => 'item',
'#title' => t('Locked permissions through modules'),
'#value' => theme('item_list', array(
'items' => $hook_locks,
)),
'#description' => t('A list of permissions that are locked through modules implementing hook_permissions_lock()'),
);
}
$form['permissions_lock_roles'] = array(
'#type' => 'fieldset',
'#title' => t('Roles'),
'#weight' => 0,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$hook_lock_roles = permissions_lock_get_hook_data('role');
$form['permissions_lock_roles']['permissions_lock_locked_roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Locked roles'),
'#description' => t("Users without the 'manage permissions unrestricted' permission will not be able to change permissions for the selected roles."),
"#default_value" => permissions_lock_get_locked_roles(),
"#options" => array_diff_key(user_roles(), $hook_lock_roles),
);
if ($hook_lock_roles) {
$form['permissions_lock_roles']['permissions_lock_hook_lock_roles'] = array(
'#type' => 'item',
'#title' => t('Locked roles through modules'),
'#value' => theme('item_list', array(
'items' => _permissions_lock_hook_roles($hook_lock_roles),
)),
'#description' => t('A list of roles that are locked through modules implementing hook_permissions_lock()'),
);
}
return system_settings_form($form);
}