public function Permission::buildOptionsForm in Views (for Drupal 7) 8.3
Provide the default form for setting options.
Overrides AccessPluginBase::buildOptionsForm
File
- lib/
Views/ user/ Plugin/ views/ access/ Permission.php, line 57 - Definition of Views\user\Plugin\views\access\Permission.
Class
- Permission
- Access plugin that provides permission-based access control.
Namespace
Views\user\Plugin\views\accessCode
public function buildOptionsForm(&$form, &$form_state) {
parent::buildOptionsForm($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.'),
);
}