You are here

public function SettingsForm::validateForm in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 src/Form/SettingsForm.php \Drupal\textimage\Form\SettingsForm::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/SettingsForm.php, line 175

Class

SettingsForm
Main Textimage settings admin form.

Namespace

Drupal\textimage\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (preg_match('/[+\\/]/', $form_state
    ->getValue([
    'settings',
    'url_generation',
    'text_separator',
  ]))) {
    $form_state
      ->setErrorByName('settings][url_generation][text_separator', $this
      ->t('Invalid characters specified for the text separator.'));
  }
}