function secure_permissions_form in Secure Permissions 7.2
Same name and namespace in other branches
- 6 secure_permissions.module \secure_permissions_form()
- 7 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 528 - 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.'),
);
$collapsed = variable_get('secure_permissions_ignore_in_export') ? FALSE : TRUE;
$form['advanced_export'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced export settings'),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
);
$form['advanced_export']['secure_permissions_ignore_in_export'] = array(
'#type' => 'textarea',
'#cols' => 40,
'#rows' => 5,
'#default_value' => variable_get('secure_permissions_ignore_in_export'),
'#title' => t('Ignore these permissions'),
'#description' => t('Comma seperated list of the machine names of the permissions to ignore like \'access devel information\'.'),
);
// 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);
}