/**
  * @param ISurveyStep $current_step
  * @param ISurveyQuestionTemplate $question
  * @param ISurveyAnswer $answer
  * @return FormField
  */
 public function build(ISurveyStep $current_step, ISurveyQuestionTemplate $question, ISurveyAnswer $answer)
 {
     $options = array();
     foreach ($question->Values()->sort('Order') as $val) {
         $options[$val->ID] = empty($val->Label) ? $val->Value : $val->Label;
     }
     $field = new OptionSetField($question->name(), $question->label(), $options);
     $default_value = $question->getDefaultValue();
     if (!is_null($default_value) && $default_value->ID > 0) {
         $field->setValue($default_value->ID);
     }
     if ($question->isReadOnly()) {
         $field->setDisabled(true);
     }
     if ($question->isMandatory()) {
         $field->setAttribute('data-rule-required', 'true');
     }
     if (!is_null($answer)) {
         $field->setValue($answer->value());
     }
     $this->buildDependantRules($current_step, $question, $field);
     return $field;
 }