original_string: public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
          $commentinlinenabled = $this->get_config('commentinline');
          $submission = $this->assignment->get_user_submission($userid, false);
          $feedbackcomments = false;
  
          if ($grade) {
              $feedbackcomments = $this->get_feedback_comments($grade->id);
          }
  
          if ($feedbackcomments && !empty($feedbackcomments->commenttext)) {
              $data->assignfeedbackcomments = $feedbackcomments->commenttext;
              $data->assignfeedbackcommentsformat = $feedbackcomments->commentformat;
          } else {
              // No feedback given yet - maybe we need to copy the text from the submission?
              if (!empty($commentinlinenabled) && $submission) {
                  $this->convert_submission_text_to_feedback($submission, $data, $grade);
              } else { // Set it to empty.
                  $data->assignfeedbackcomments = '';
                  $data->assignfeedbackcommentsformat = FORMAT_HTML;
              }
          }
  
          file_prepare_standard_editor(
              $data,
              'assignfeedbackcomments',
              $this->get_editor_options(),
              $this->assignment->get_context(),
              ASSIGNFEEDBACK_COMMENTS_COMPONENT,
              ASSIGNFEEDBACK_COMMENTS_FILEAREA,
              $grade->id
          );
  
          $mform->addElement('editor', 'assignfeedbackcomments_editor', $this->get_name(), null, $this->get_editor_options());
  
          return true;
      }
code: public function get_form_elements_for_user($grade, MoodleQuickForm $mform, stdClass $data, $userid) {
          $commentinlinenabled = $this->get_config('commentinline');
          $submission = $this->assignment->get_user_submission($userid, false);
          $feedbackcomments = false;
  
          if ($grade) {
              $feedbackcomments = $this->get_feedback_comments($grade->id);
          }
  
          if ($feedbackcomments && !empty($feedbackcomments->commenttext)) {
              $data->assignfeedbackcomments = $feedbackcomments->commenttext;
              $data->assignfeedbackcommentsformat = $feedbackcomments->commentformat;
          } else {
              // No feedback given yet - maybe we need to copy the text from the submission?
              if (!empty($commentinlinenabled) && $submission) {
                  $this->convert_submission_text_to_feedback($submission, $data, $grade);
              } else { // Set it to empty.
                  $data->assignfeedbackcomments = '';
                  $data->assignfeedbackcommentsformat = FORMAT_HTML;
              }
          }
  
          file_prepare_standard_editor(
              $data,
              'assignfeedbackcomments',
              $this->get_editor_options(),
              $this->assignment->get_context(),
              ASSIGNFEEDBACK_COMMENTS_COMPONENT,
              ASSIGNFEEDBACK_COMMENTS_FILEAREA,
              $grade->id
          );
  
          $mform->addElement('editor', 'assignfeedbackcomments_editor', $this->get_name(), null, $this->get_editor_options());
  
          return true;
      }
code_tokens: public function get_form_elements_for_user ( $ grade , MoodleQuickForm $ mform , stdClass $ data , $ userid ) { $ commentinlinenabled = $ this -> get_config ( 'commentinline' ) ; $ submission = $ this -> assignment -> get_user_submission ( $ userid , false ) ; $ feedbackcomments = false ; if ( $ grade ) { $ feedbackcomments = $ this -> get_feedback_comments ( $ grade -> id ) ; } if ( $ feedbackcomments && ! empty ( $ feedbackcomments -> commenttext ) ) { $ data -> assignfeedbackcomments = $ feedbackcomments -> commenttext ; $ data -> assignfeedbackcommentsformat = $ feedbackcomments -> commentformat ; } else { // No feedback given yet - maybe we need to copy the text from the submission? if ( ! empty ( $ commentinlinenabled ) && $ submission ) { $ this -> convert_submission_text_to_feedback ( $ submission , $ data , $ grade ) ; } else { // Set it to empty. $ data -> assignfeedbackcomments = '' ; $ data -> assignfeedbackcommentsformat = FORMAT_HTML ; } } file_prepare_standard_editor ( $ data , 'assignfeedbackcomments' , $ this -> get_editor_options ( ) , $ this -> assignment -> get_context ( ) , ASSIGNFEEDBACK_COMMENTS_COMPONENT , ASSIGNFEEDBACK_COMMENTS_FILEAREA , $ grade -> id ) ; $ mform -> addElement ( 'editor' , 'assignfeedbackcomments_editor' , $ this -> get_name ( ) , null , $ this -> get_editor_options ( ) ) ; return true ; }
docstring: Get form elements for the grading page
  
  @param stdClass|null $grade
  @param MoodleQuickForm $mform
  @param stdClass $data
  @return bool true if elements were added to the form
docstring_tokens: Get form elements for the grading page