function secure_permissions_form in Secure Permissions 7
Same name and namespace in other branches
- 6 secure_permissions.module \secure_permissions_form()
- 7.2 secure_permissions.module \secure_permissions_form()
Configuration form for the module.
1 string reference to 'secure_permissions_form'
- secure_permissions_menu in ./
secure_permissions.module - Implements hook_menu().
File
- ./
secure_permissions.module, line 465 - Secure Permissions module file.
Code
function secure_permissions_form() {
$form = array();
$items = array();
// Check which modules run our hook,
$modules = module_implements('secure_permissions');
$files = system_rebuild_module_data();
foreach ($modules as $module) {
if ($module != 'secure_permissions') {
$items[] = check_plain($files[$module]->info['name']);
}
}
$module_list = theme('item_list', array(
'items' => $items,
));
$extra = '';
if (count($modules) == 1) {
$extra = t('Your permissions have not been <a href="!url">exported to code</a> yet. You may need to do so before activating this module.', array(
'!url' => url('admin/people/secure_permissions/export'),
));
}
$form['help'] = array(
'#markup' => t('The following modules implement secure permissions: !list !extra', array(
'!list' => $module_list,
'!extra' => $extra,
)),
);
$form['user_interface'] = array(
'#type' => 'fieldset',
'#title' => t('User interface settings'),
);
$form['user_interface']['secure_permissions_disable_forms'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_disable_forms'),
'#title' => t('Disable permissions and roles forms'),
'#description' => t('Disables the ability to edit or add permissions and roles through the user interface.'),
);
$form['user_interface']['secure_permissions_show_permissions_page'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_show_permissions_page'),
'#title' => t('Show permissions page'),
'#description' => t('Allows administrators to view the permissions overview page.'),
);
$form['user_interface']['secure_permissions_show_roles_page'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_show_roles_page'),
'#title' => t('Show roles page'),
'#description' => t('Allows administrators to view the roles overview page.'),
);
$form['user_interface']['secure_permissions_verbose'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_verbose'),
'#title' => t('Display permissions updates'),
'#description' => t('Prints a message to the screen whenever permissions are updated.'),
);
$form['code'] = array(
'#type' => 'fieldset',
'#title' => t('API settings'),
'#description' => t('If the <em>Load permissions from code</em> setting is not enabled, none of the features below will be enabled.'),
);
$form['code']['secure_permissions_active'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_active'),
'#title' => t('Load permissions from code'),
'#description' => t('Allows permissions and roles to be defined in code, replacing values set through the user interface.'),
);
$form['code']['secure_permissions_use_default'] = array(
'#type' => 'checkbox',
'#default_value' => secure_permissions_variable('secure_permissions_use_default'),
'#title' => t('Reload default permissions on rebuild'),
'#description' => t('Sets the default Drupal permissions for anonymous and authenticated users.'),
);
// Make sure the menu is rebuilt correctly.
$form['#submit'][] = 'secure_permissions_form_submit';
if (isset($_SESSION['secure_permissions_rebuild'])) {
unset($_SESSION['secure_permissions_rebuild']);
menu_rebuild();
}
return system_settings_form($form);
}