You are here

public function views_plugin_access_perm::options_form in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_access_perm.inc \views_plugin_access_perm::options_form()
  2. 6.2 plugins/views_plugin_access_perm.inc \views_plugin_access_perm::options_form()

Provide the default form for setting options.

Overrides views_plugin_access::options_form

File

plugins/views_plugin_access_perm.inc, line 55
Definition of views_plugin_access_perm.

Class

views_plugin_access_perm
Access plugin that provides permission-based access control.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $perms = array();
  $module_info = system_get_info('module');

  // Get list of permissions.
  foreach (module_implements('permission') as $module) {
    $permissions = module_invoke($module, 'permission');
    foreach ($permissions as $name => $perm) {
      $perms[$module_info[$module]['name']][$name] = strip_tags($perm['title']);
    }
  }
  ksort($perms);
  $form['perm'] = array(
    '#type' => 'select',
    '#options' => $perms,
    '#title' => t('Permission'),
    '#default_value' => $this->options['perm'],
    '#description' => t('Only users with the selected permission flag will be able to access this display. Note that users with "access all views" can see any view, regardless of other permissions.'),
  );
}