public function GroupPermission::buildOptionsForm in Group 8
Same name and namespace in other branches
- 2.0.x src/Plugin/views/access/GroupPermission.php \Drupal\group\Plugin\views\access\GroupPermission::buildOptionsForm()
Provide a form to edit options for this plugin.
Overrides PluginBase::buildOptionsForm
File
- src/
Plugin/ views/ access/ GroupPermission.php, line 147
Class
- GroupPermission
- Access plugin that provides group permission-based access control.
Namespace
Drupal\group\Plugin\views\accessCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
// Get list of permissions.
$permissions = [];
foreach ($this->permissionHandler
->getPermissions(TRUE) as $permission_name => $permission) {
$display_name = $this->moduleHandler
->getName($permission['provider']);
$permissions[$display_name . ' : ' . $permission['section']][$permission_name] = strip_tags($permission['title']);
}
$form['group_permission'] = [
'#type' => 'select',
'#options' => $permissions,
'#title' => $this
->t('Group permission'),
'#default_value' => $this->options['group_permission'],
'#description' => $this
->t('Only users with the selected group permission will be able to access this display.<br /><strong>Warning:</strong> This will only work if there is a {group} parameter in the route. If not, it will always deny access.'),
];
}