You are here

public function SimpleAccessViewsAccess::validateOptionsForm in Simple Access 8.3

Validate the options form.

Overrides PluginBase::validateOptionsForm

File

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

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 validateOptionsForm(&$form, FormStateInterface $form_state) {
  if (!array_filter($form_state['values']['access_options']['groups'])) {
    $form_state
      ->setError($form['groups'], $this
      ->t('You must select at least one group if type is "by group"'));
  }
}