You are here

public function JstimerAdminSettings::validateForm in Javascript Timer 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/JstimerAdminSettings.php, line 54
Contains \Drupal\jstimer\Form\JstimerAdminSettings.

Class

JstimerAdminSettings

Namespace

Drupal\jstimer\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValues() as $key => $value) {
    if (substr($key, 0, 11) == "jstimer_js_") {
      if (!strpos($value, "'") === FALSE) {
        $form_state
          ->setErrorByName($key, $this
          ->t("Javascript Timer admin settings may not contain single quotes(')."));
      }
    }
  }
}