original_string: public function render_editor_content($filearea, $submissionid, $plugintype, $editor, $component, $shortentext = false) {
          global $CFG;
  
          $result = '';
  
          $plugin = $this->get_submission_plugin_by_type($plugintype);
  
          $text = $plugin->get_editor_text($editor, $submissionid);
          if ($shortentext) {
              $text = shorten_text($text, 140);
          }
          $format = $plugin->get_editor_format($editor, $submissionid);
  
          $finaltext = file_rewrite_pluginfile_urls($text,
                                                    'pluginfile.php',
                                                    $this->get_context()->id,
                                                    $component,
                                                    $filearea,
                                                    $submissionid);
          $params = array('overflowdiv' => true, 'context' => $this->get_context());
          $result .= format_text($finaltext, $format, $params);
  
          if ($CFG->enableportfolios && has_capability('mod/assign:exportownsubmission', $this->context)) {
              require_once($CFG->libdir . '/portfoliolib.php');
  
              $button = new portfolio_add_button();
              $portfolioparams = array('cmid' => $this->get_course_module()->id,
                                       'sid' => $submissionid,
                                       'plugin' => $plugintype,
                                       'editor' => $editor,
                                       'area'=>$filearea);
              $button->set_callback_options('assign_portfolio_caller', $portfolioparams, 'mod_assign');
              $fs = get_file_storage();
  
              if ($files = $fs->get_area_files($this->context->id,
                                               $component,
                                               $filearea,
                                               $submissionid,
                                               'timemodified',
                                               false)) {
                  $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
              } else {
                  $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
              }
              $result .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
          }
          return $result;
      }
code: public function render_editor_content($filearea, $submissionid, $plugintype, $editor, $component, $shortentext = false) {
          global $CFG;
  
          $result = '';
  
          $plugin = $this->get_submission_plugin_by_type($plugintype);
  
          $text = $plugin->get_editor_text($editor, $submissionid);
          if ($shortentext) {
              $text = shorten_text($text, 140);
          }
          $format = $plugin->get_editor_format($editor, $submissionid);
  
          $finaltext = file_rewrite_pluginfile_urls($text,
                                                    'pluginfile.php',
                                                    $this->get_context()->id,
                                                    $component,
                                                    $filearea,
                                                    $submissionid);
          $params = array('overflowdiv' => true, 'context' => $this->get_context());
          $result .= format_text($finaltext, $format, $params);
  
          if ($CFG->enableportfolios && has_capability('mod/assign:exportownsubmission', $this->context)) {
              require_once($CFG->libdir . '/portfoliolib.php');
  
              $button = new portfolio_add_button();
              $portfolioparams = array('cmid' => $this->get_course_module()->id,
                                       'sid' => $submissionid,
                                       'plugin' => $plugintype,
                                       'editor' => $editor,
                                       'area'=>$filearea);
              $button->set_callback_options('assign_portfolio_caller', $portfolioparams, 'mod_assign');
              $fs = get_file_storage();
  
              if ($files = $fs->get_area_files($this->context->id,
                                               $component,
                                               $filearea,
                                               $submissionid,
                                               'timemodified',
                                               false)) {
                  $button->set_formats(PORTFOLIO_FORMAT_RICHHTML);
              } else {
                  $button->set_formats(PORTFOLIO_FORMAT_PLAINHTML);
              }
              $result .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
          }
          return $result;
      }
code_tokens: public function render_editor_content ( $ filearea , $ submissionid , $ plugintype , $ editor , $ component , $ shortentext = false ) { global $ CFG ; $ result = '' ; $ plugin = $ this -> get_submission_plugin_by_type ( $ plugintype ) ; $ text = $ plugin -> get_editor_text ( $ editor , $ submissionid ) ; if ( $ shortentext ) { $ text = shorten_text ( $ text , 140 ) ; } $ format = $ plugin -> get_editor_format ( $ editor , $ submissionid ) ; $ finaltext = file_rewrite_pluginfile_urls ( $ text , 'pluginfile.php' , $ this -> get_context ( ) -> id , $ component , $ filearea , $ submissionid ) ; $ params = array ( 'overflowdiv' => true , 'context' => $ this -> get_context ( ) ) ; $ result .= format_text ( $ finaltext , $ format , $ params ) ; if ( $ CFG -> enableportfolios && has_capability ( 'mod/assign:exportownsubmission' , $ this -> context ) ) { require_once ( $ CFG -> libdir . '/portfoliolib.php' ) ; $ button = new portfolio_add_button ( ) ; $ portfolioparams = array ( 'cmid' => $ this -> get_course_module ( ) -> id , 'sid' => $ submissionid , 'plugin' => $ plugintype , 'editor' => $ editor , 'area' => $ filearea ) ; $ button -> set_callback_options ( 'assign_portfolio_caller' , $ portfolioparams , 'mod_assign' ) ; $ fs = get_file_storage ( ) ; if ( $ files = $ fs -> get_area_files ( $ this -> context -> id , $ component , $ filearea , $ submissionid , 'timemodified' , false ) ) { $ button -> set_formats ( PORTFOLIO_FORMAT_RICHHTML ) ; } else { $ button -> set_formats ( PORTFOLIO_FORMAT_PLAINHTML ) ; } $ result .= $ button -> to_html ( PORTFOLIO_ADD_TEXT_LINK ) ; } return $ result ; }
docstring: Render the content in editor that is often used by plugin.
  
  @param string $filearea
  @param int $submissionid
  @param string $plugintype
  @param string $editor
  @param string $component
  @param bool $shortentext Whether to shorten the text content.
  @return string
docstring_tokens: Render the content in editor that is often used by plugin .