public function QuizAdminSettings::validateForm in Quiz 8.4
Validation of the Form Settings form.
Checks the values for the form administration form for quiz settings.
Overrides FormBase::validateForm
File
- lib/
Drupal/ quiz/ Form/ QuizAdminSettings.php, line 228 - Contains \Drupal\quiz\Form\QuizAdminSettings.
Class
- QuizAdminSettings
- This builds the main settings form for the quiz module.
Namespace
Drupal\quiz\FormCode
public function validateForm(array &$form, array &$form_state) {
if (!_quiz_is_int($form_state['values']['quiz_default_close'])) {
form_set_error('quiz_default_close', $form_state, t('The default number of days before a quiz is closed must be a number greater than 0.'));
}
if (!_quiz_is_int($form_state['values']['quiz_autotitle_length'], 0, 128)) {
form_set_error('quiz_autotitle_length', $form_state, t('The autotitle length value must be an integer between 0 and 128.'));
}
if (!_quiz_is_int($form_state['values']['quiz_max_result_options'], 0, 100)) {
form_set_error('quiz_max_result_options', $form_state, t('The number of resultoptions must be an integer between 0 and 100.'));
}
if (!_quiz_is_plain($form_state['values']['quiz_name'])) {
form_set_error('quiz_name', $form_state, t('The quiz name must be plain text.'));
}
/*if (!_quiz_is_plain($form_state['values']['quiz_action_type']))
form_set_error('quiz_action_type', t('The action type must be plain text.'));*/
}