function ctools_perm_ctools_access_settings

Settings form for the 'by perm' access plugin.

1 string reference to 'ctools_perm_ctools_access_settings'
perm.inc in plugins/access/perm.inc
Plugin to provide access control based on user permission strings.

File

plugins/access/perm.inc, line 25

Code

function ctools_perm_ctools_access_settings($form, &$form_state, $conf) {
  $perms = 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) {
        $perms[$module][$id] = $permission['title'];
      }
    }
  }
  $form['settings']['perm'] = array(
    '#type' => 'select',
    '#options' => $perms,
    '#title' => t('Permission'),
    '#default_value' => $conf['perm'],
    '#description' => t('Only users with the selected permission flag will be able to access this.'),
  );
  return $form;
}