original_string: protected function definition_answer_choice(&$mform) {
          $mform->addElement('header', 'choicehdr', get_string('choices', 'qtype_gapselect'));
          $mform->setExpanded('choicehdr', 1);
  
          $mform->addElement('checkbox', 'shuffleanswers', get_string('shuffle', 'qtype_gapselect'));
          $mform->setDefault('shuffleanswers', 0);
  
          $textboxgroup = array();
          $textboxgroup[] = $mform->createElement('group', 'choices',
                  get_string('choicex', 'qtype_gapselect'), $this->choice_group($mform));
  
          if (isset($this->question->options)) {
              $countanswers = count($this->question->options->answers);
          } else {
              $countanswers = 0;
          }
  
          if ($this->question->formoptions->repeatelements) {
              $defaultstartnumbers = QUESTION_NUMANS_START * 2;
              $repeatsatstart = max($defaultstartnumbers, QUESTION_NUMANS_START,
                      $countanswers + QUESTION_NUMANS_ADD);
          } else {
              $repeatsatstart = $countanswers;
          }
  
          $repeatedoptions = $this->repeated_options();
          $mform->setType('answer', PARAM_RAW);
          $this->repeat_elements($textboxgroup, $repeatsatstart, $repeatedoptions,
                  'noanswers', 'addanswers', QUESTION_NUMANS_ADD,
                  get_string('addmorechoiceblanks', 'qtype_gapselect'), true);
      }
code: protected function definition_answer_choice(&$mform) {
          $mform->addElement('header', 'choicehdr', get_string('choices', 'qtype_gapselect'));
          $mform->setExpanded('choicehdr', 1);
  
          $mform->addElement('checkbox', 'shuffleanswers', get_string('shuffle', 'qtype_gapselect'));
          $mform->setDefault('shuffleanswers', 0);
  
          $textboxgroup = array();
          $textboxgroup[] = $mform->createElement('group', 'choices',
                  get_string('choicex', 'qtype_gapselect'), $this->choice_group($mform));
  
          if (isset($this->question->options)) {
              $countanswers = count($this->question->options->answers);
          } else {
              $countanswers = 0;
          }
  
          if ($this->question->formoptions->repeatelements) {
              $defaultstartnumbers = QUESTION_NUMANS_START * 2;
              $repeatsatstart = max($defaultstartnumbers, QUESTION_NUMANS_START,
                      $countanswers + QUESTION_NUMANS_ADD);
          } else {
              $repeatsatstart = $countanswers;
          }
  
          $repeatedoptions = $this->repeated_options();
          $mform->setType('answer', PARAM_RAW);
          $this->repeat_elements($textboxgroup, $repeatsatstart, $repeatedoptions,
                  'noanswers', 'addanswers', QUESTION_NUMANS_ADD,
                  get_string('addmorechoiceblanks', 'qtype_gapselect'), true);
      }
code_tokens: protected function definition_answer_choice ( & $ mform ) { $ mform -> addElement ( 'header' , 'choicehdr' , get_string ( 'choices' , 'qtype_gapselect' ) ) ; $ mform -> setExpanded ( 'choicehdr' , 1 ) ; $ mform -> addElement ( 'checkbox' , 'shuffleanswers' , get_string ( 'shuffle' , 'qtype_gapselect' ) ) ; $ mform -> setDefault ( 'shuffleanswers' , 0 ) ; $ textboxgroup = array ( ) ; $ textboxgroup [ ] = $ mform -> createElement ( 'group' , 'choices' , get_string ( 'choicex' , 'qtype_gapselect' ) , $ this -> choice_group ( $ mform ) ) ; if ( isset ( $ this -> question -> options ) ) { $ countanswers = count ( $ this -> question -> options -> answers ) ; } else { $ countanswers = 0 ; } if ( $ this -> question -> formoptions -> repeatelements ) { $ defaultstartnumbers = QUESTION_NUMANS_START * 2 ; $ repeatsatstart = max ( $ defaultstartnumbers , QUESTION_NUMANS_START , $ countanswers + QUESTION_NUMANS_ADD ) ; } else { $ repeatsatstart = $ countanswers ; } $ repeatedoptions = $ this -> repeated_options ( ) ; $ mform -> setType ( 'answer' , PARAM_RAW ) ; $ this -> repeat_elements ( $ textboxgroup , $ repeatsatstart , $ repeatedoptions , 'noanswers' , 'addanswers' , QUESTION_NUMANS_ADD , get_string ( 'addmorechoiceblanks' , 'qtype_gapselect' ) , true ) ; }
docstring: Defines form elements for answer choices.
  
  @param object $mform The Moodle form object being built
docstring_tokens: Defines form elements for answer choices .