You are here

public function SettingsForm::validateForm in Amazon Product Advertisement API 8.2

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/SettingsForm.php, line 99
Contains Drupal\amazon\Form\SettingsForm.

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\amazon\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (empty(Amazon::getAccessKey()) && empty($form_state
    ->getValue('access_key'))) {
    $form_state
      ->setErrorByName('access_key', $this
      ->t('If you do not specify an access key here, you must use one of the other methods of providing this information, such as a server environment variable or a $config setting in settings.php.'));
  }
  parent::validateForm($form, $form_state);
}