Skip to content

Commit

Permalink
OPENEUROPA-1500: Update field type from textfield to number and remov…
Browse files Browse the repository at this point in the history
…e the custom validation hook.
  • Loading branch information
drupol committed Jan 8, 2019
1 parent b6ab8c1 commit e1a9e9a
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
Expand All @@ -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}
*/
Expand Down

0 comments on commit e1a9e9a

Please sign in to comment.