You are here

public function GeshiFilterSettingsForm::validateForm in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 src/Form/GeshiFilterSettingsForm.php \Drupal\geshifilter\Form\GeshiFilterSettingsForm::validateForm()

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/GeshiFilterSettingsForm.php, line 251

Class

GeshiFilterSettingsForm
Form with the settings for the module.

Namespace

Drupal\geshifilter\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Check if automatically managed style sheet is posible.
  if ($form_state
    ->hasValue('css_mode') && $form_state
    ->getValue('css_mode') == GeshiFilter::CSS_CLASSES_AUTOMATIC && !GeshiFilterCss::managedExternalStylesheetPossible()) {
    $form_state
      ->setErrorByName('css_mode', $this
      ->t('GeSHi filter can not
        automatically manage an external CSS style sheet when the download method
        is private.'));
  }
}