original_string: public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
          $elements = array();
  
          $editoroptions = $this->get_edit_options();
          $submissionid = $submission ? $submission->id : 0;
  
          if (!isset($data->onlinetext)) {
              $data->onlinetext = '';
          }
          if (!isset($data->onlinetextformat)) {
              $data->onlinetextformat = editors_get_preferred_format();
          }
  
          if ($submission) {
              $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
              if ($onlinetextsubmission) {
                  $data->onlinetext = $onlinetextsubmission->onlinetext;
                  $data->onlinetextformat = $onlinetextsubmission->onlineformat;
              }
  
          }
  
          $data = file_prepare_standard_editor($data,
                                               'onlinetext',
                                               $editoroptions,
                                               $this->assignment->get_context(),
                                               'assignsubmission_onlinetext',
                                               ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                               $submissionid);
          $mform->addElement('editor', 'onlinetext_editor', $this->get_name(), null, $editoroptions);
  
          return true;
      }
code: public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {
          $elements = array();
  
          $editoroptions = $this->get_edit_options();
          $submissionid = $submission ? $submission->id : 0;
  
          if (!isset($data->onlinetext)) {
              $data->onlinetext = '';
          }
          if (!isset($data->onlinetextformat)) {
              $data->onlinetextformat = editors_get_preferred_format();
          }
  
          if ($submission) {
              $onlinetextsubmission = $this->get_onlinetext_submission($submission->id);
              if ($onlinetextsubmission) {
                  $data->onlinetext = $onlinetextsubmission->onlinetext;
                  $data->onlinetextformat = $onlinetextsubmission->onlineformat;
              }
  
          }
  
          $data = file_prepare_standard_editor($data,
                                               'onlinetext',
                                               $editoroptions,
                                               $this->assignment->get_context(),
                                               'assignsubmission_onlinetext',
                                               ASSIGNSUBMISSION_ONLINETEXT_FILEAREA,
                                               $submissionid);
          $mform->addElement('editor', 'onlinetext_editor', $this->get_name(), null, $editoroptions);
  
          return true;
      }
code_tokens: public function get_form_elements ( $ submission , MoodleQuickForm $ mform , stdClass $ data ) { $ elements = array ( ) ; $ editoroptions = $ this -> get_edit_options ( ) ; $ submissionid = $ submission ? $ submission -> id : 0 ; if ( ! isset ( $ data -> onlinetext ) ) { $ data -> onlinetext = '' ; } if ( ! isset ( $ data -> onlinetextformat ) ) { $ data -> onlinetextformat = editors_get_preferred_format ( ) ; } if ( $ submission ) { $ onlinetextsubmission = $ this -> get_onlinetext_submission ( $ submission -> id ) ; if ( $ onlinetextsubmission ) { $ data -> onlinetext = $ onlinetextsubmission -> onlinetext ; $ data -> onlinetextformat = $ onlinetextsubmission -> onlineformat ; } } $ data = file_prepare_standard_editor ( $ data , 'onlinetext' , $ editoroptions , $ this -> assignment -> get_context ( ) , 'assignsubmission_onlinetext' , ASSIGNSUBMISSION_ONLINETEXT_FILEAREA , $ submissionid ) ; $ mform -> addElement ( 'editor' , 'onlinetext_editor' , $ this -> get_name ( ) , null , $ editoroptions ) ; return true ; }
docstring: Add form elements for settings
  
  @param mixed $submission can be null
  @param MoodleQuickForm $mform
  @param stdClass $data
  @return true if elements were added to the form
docstring_tokens: Add form elements for settings