original_string: protected function data_preprocessing_extra_answer_fields($question, $extraanswerfields) {
          // Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field.
          // As we may have several extra fields with data for several answers in each, we use an array of arrays.
          // Index in $extrafieldsdata is an extra answer field name, value - array of it's data for each answer.
          $extrafieldsdata = array();
          // First, prepare an array if empty arrays for each extra answer fields data.
          foreach ($extraanswerfields as $field) {
              $extrafieldsdata[$field] = array();
          }
  
          // Fill arrays with data from $question->options->answers.
          $key = 0;
          foreach ($question->options->answers as $answer) {
              foreach ($extraanswerfields as $field) {
                  // See hack comment in {@link data_preprocessing_answers()}.
                  unset($this->_form->_defaultValues["{$field}[{$key}]"]);
                  $extrafieldsdata[$field][$key] = $this->data_preprocessing_extra_answer_field($answer, $field);
              }
              $key++;
          }
  
          // Set this data in the $question object.
          foreach ($extraanswerfields as $field) {
              $question->$field = $extrafieldsdata[$field];
          }
          return $question;
      }
code: protected function data_preprocessing_extra_answer_fields($question, $extraanswerfields) {
          // Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field.
          // As we may have several extra fields with data for several answers in each, we use an array of arrays.
          // Index in $extrafieldsdata is an extra answer field name, value - array of it's data for each answer.
          $extrafieldsdata = array();
          // First, prepare an array if empty arrays for each extra answer fields data.
          foreach ($extraanswerfields as $field) {
              $extrafieldsdata[$field] = array();
          }
  
          // Fill arrays with data from $question->options->answers.
          $key = 0;
          foreach ($question->options->answers as $answer) {
              foreach ($extraanswerfields as $field) {
                  // See hack comment in {@link data_preprocessing_answers()}.
                  unset($this->_form->_defaultValues["{$field}[{$key}]"]);
                  $extrafieldsdata[$field][$key] = $this->data_preprocessing_extra_answer_field($answer, $field);
              }
              $key++;
          }
  
          // Set this data in the $question object.
          foreach ($extraanswerfields as $field) {
              $question->$field = $extrafieldsdata[$field];
          }
          return $question;
      }
code_tokens: protected function data_preprocessing_extra_answer_fields ( $ question , $ extraanswerfields ) { // Setting $question->$field[$key] won't work in PHP, so we need set an array of answer values to $question->$field. // As we may have several extra fields with data for several answers in each, we use an array of arrays. // Index in $extrafieldsdata is an extra answer field name, value - array of it's data for each answer. $ extrafieldsdata = array ( ) ; // First, prepare an array if empty arrays for each extra answer fields data. foreach ( $ extraanswerfields as $ field ) { $ extrafieldsdata [ $ field ] = array ( ) ; } // Fill arrays with data from $question->options->answers. $ key = 0 ; foreach ( $ question -> options -> answers as $ answer ) { foreach ( $ extraanswerfields as $ field ) { // See hack comment in {@link data_preprocessing_answers()}. unset ( $ this -> _form -> _defaultValues [ "{$field}[{$key}]" ] ) ; $ extrafieldsdata [ $ field ] [ $ key ] = $ this -> data_preprocessing_extra_answer_field ( $ answer , $ field ) ; } $ key ++ ; } // Set this data in the $question object. foreach ( $ extraanswerfields as $ field ) { $ question -> $ field = $ extrafieldsdata [ $ field ] ; } return $ question ; }
docstring: Perform the necessary preprocessing for the extra answer fields.
  
  Questions that do something not trivial when editing extra answer fields
  will want to override this.
  @param object $question the data being passed to the form.
  @param array $extraanswerfields extra answer fields (without table name).
  @return object $question the modified data.
docstring_tokens: Perform the necessary preprocessing for the extra answer fields .