1 user_permission_layout_access.inc | UserPermissionLayoutAccess::form(&$form, &$form_state) |
Settings form for configuring this access item.
Overrides LayoutAccess::form
File
- core/
modules/ layout/ plugins/ access/ user_permission_layout_access.inc, line 45 - Plugin to provide access control based on user permission strings.
Class
- UserPermissionLayoutAccess
- @file Plugin to provide access control based on user permission strings.
Code
function form(&$form, &$form_state) {
parent::form($form, $form_state);
$options = array();
// Get list of permissions
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
// By keeping them keyed by module we can use optgroups with the
// 'select' type.
if ($permissions = module_invoke($module, 'permission')) {
foreach ($permissions as $id => $permission) {
$options[$module][$id] = strip_tags($permission['title']);
}
}
}
$form['permission'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t('Permission'),
'#default_value' => $this->settings['permission'],
'#description' => t('Only users with the selected permission flag will be able to access this.'),
);
}