You are here

public function LocalFontConfigEntityForm::validateForm in @font-your-face 8.3

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

modules/local_fonts/src/Form/LocalFontConfigEntityForm.php, line 112

Class

LocalFontConfigEntityForm
Config form to set the local fonts.

Namespace

Drupal\local_fonts\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $local_font_config_entity = $this->entity;
  $values = $form_state
    ->getValues();
  if (empty($values['font_file']) && empty($local_font_config_entity
    ->getFontWoffData())) {
    $form_state
      ->setErrorByName('font_file', $this
      ->t('WOFF file must be uploaded'));
  }
}