You are here

public function SimpleAccessViewsAccess::buildOptionsForm in Simple Access 8.3

Provide a form to edit options for this plugin.

Overrides PluginBase::buildOptionsForm

File

src/views/access/SimpleAccessViewsAccess.php, line 81

Class

SimpleAccessViewsAccess
Plugin annotation @ViewsAccess( id = "simple_access_group", title = @Translation("Simple Access Group"), help = @Translation("Will be available to all users.") )

Namespace

Drupal\simple_access\views\access

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $options = array_map([
    'simple_access_views_plugin_group',
    '_map_groups',
  ], simple_access_get_groups());
  $form['groups'] = [
    '#type' => 'checkboxes',
    '#title' => t('Simple access groups'),
    '#default_value' => $this->options['groups'],
    '#options' => $options,
    '#description' => $this
      ->t('Only the checked simple access groups will be able to access this display. Note that users with "access all views" can see any view, regardless of role.'),
  ];
}