You are here

public function Domain::validateOptionsForm in Domain Access 8

Validate the options form.

Overrides PluginBase::validateOptionsForm

File

domain/src/Plugin/views/access/Domain.php, line 141

Class

Domain
Access plugin that provides domain-based access control.

Namespace

Drupal\domain\Plugin\views\access

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
  $domain = $form_state
    ->getValue([
    'access_options',
    'domain',
  ]);
  $domain = array_filter($domain);
  if (!$domain) {
    $form_state
      ->setError($form['domain'], $this
      ->t('You must select at least one domain if type is "by domain"'));
  }
  $form_state
    ->setValue([
    'access_options',
    'domain',
  ], $domain);
}