You are here

public function ModuleActivitiesForm::maxScoreValidate in Opigno module 3.x

Same name and namespace in other branches
  1. 8 src/Form/ModuleActivitiesForm.php \Drupal\opigno_module\Form\ModuleActivitiesForm::maxScoreValidate()

Validates max score.

File

src/Form/ModuleActivitiesForm.php, line 167

Class

ModuleActivitiesForm
Class ModuleActivitiesForm.

Namespace

Drupal\opigno_module\Form

Code

public function maxScoreValidate($element, FormStateInterface $form_state, $form) {
  if ($element['#value'] > 100) {
    $form_state
      ->setError($element, $this
      ->t('Max score must be equal or less then 100'));
  }
}