From e1a9e9a9d8e45d035c2af07a48a676ef868c98db Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Tue, 8 Jan 2019 14:30:32 +0100 Subject: [PATCH] OPENEUROPA-1500: Update field type from textfield to number and remove the custom validation hook. --- .../src/Form/WebtoolsAnalyticsSettingsForm.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/modules/oe_webtools_analytics/src/Form/WebtoolsAnalyticsSettingsForm.php b/modules/oe_webtools_analytics/src/Form/WebtoolsAnalyticsSettingsForm.php index 6bd6ac06..02214d9e 100644 --- a/modules/oe_webtools_analytics/src/Form/WebtoolsAnalyticsSettingsForm.php +++ b/modules/oe_webtools_analytics/src/Form/WebtoolsAnalyticsSettingsForm.php @@ -36,7 +36,7 @@ protected function getEditableConfigNames() { */ public function buildForm(array $form, FormStateInterface $form_state) { $form['siteID'] = [ - '#type' => 'textfield', + '#type' => 'number', '#title' => $this->t('Site ID'), '#default_value' => $this->config(static::CONFIGNAME)->get('siteID'), '#description' => $this->t('The site unique numeric identifier.'), @@ -56,18 +56,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { return parent::buildForm($form, $form_state); } - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - parent::validateForm($form, $form_state); - - $site_id = $form_state->getValue('siteID'); - if (!is_numeric($site_id)) { - $form_state->setErrorByName('siteID', $this->t('The value must be numeric.')); - } - } - /** * {@inheritdoc} */