public function TeamPermission::buildOptionsForm in Apigee Edge 8
Provide a form to edit options for this plugin.
Overrides PluginBase::buildOptionsForm
File
- modules/
apigee_edge_teams/ src/ Plugin/ views/ access/ TeamPermission.php, line 129
Class
- TeamPermission
- Access plugin for team-permission-based access control.
Namespace
Drupal\apigee_edge_teams\Plugin\views\accessCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$options = array_reduce($this->teamPermissionHandler
->getPermissions(), function (array $options, TeamPermissionEntity $permission) {
$options[$permission
->getName()] = $permission
->getLabel();
return $options;
}, []);
$form['permission'] = [
'#type' => 'select',
'#options' => $options,
'#title' => $this
->t('Team permission'),
'#default_value' => $this->options['permission'],
'#description' => $this
->t('Only users with the selected permission for the current team will be able to access this display.'),
];
}