You are here

public function ValidateFormBase::validateForm in Node Accessibility 8

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

src/Form/ValidateFormBase.php, line 161

Class

ValidateFormBase
Base Form controller for the node_accessibility entity validate forms.

Namespace

Drupal\node_accessibility\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!\Drupal::currentUser()
    ->hasPermission('perform node accessibility validation')) {
    $form_state
      ->setErrorByName('actions][submit_validate', $this
      ->t('You are not authorized to perform validation at this time.'));
  }
}