original_string: public function format_external_text() {
  
          if ($this->editorcontext === null) {
              // Switch on the event type to decide upon the appropriate context to use for this event.
              $this->editorcontext = $this->get_context();
  
              if (!calendar_is_valid_eventtype($this->properties->eventtype)) {
                  // We don't have a context here, do a normal format_text.
                  return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id);
              }
          }
  
          // Work out the item id for the editor, if this is a repeated event then the files will be associated with the original.
          if (!empty($this->properties->repeatid) && $this->properties->repeatid > 0) {
              $itemid = $this->properties->repeatid;
          } else {
              $itemid = $this->properties->id;
          }
  
          return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id,
              'calendar', 'event_description', $itemid);
      }
code: public function format_external_text() {
  
          if ($this->editorcontext === null) {
              // Switch on the event type to decide upon the appropriate context to use for this event.
              $this->editorcontext = $this->get_context();
  
              if (!calendar_is_valid_eventtype($this->properties->eventtype)) {
                  // We don't have a context here, do a normal format_text.
                  return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id);
              }
          }
  
          // Work out the item id for the editor, if this is a repeated event then the files will be associated with the original.
          if (!empty($this->properties->repeatid) && $this->properties->repeatid > 0) {
              $itemid = $this->properties->repeatid;
          } else {
              $itemid = $this->properties->id;
          }
  
          return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id,
              'calendar', 'event_description', $itemid);
      }
code_tokens: public function format_external_text ( ) { if ( $ this -> editorcontext === null ) { // Switch on the event type to decide upon the appropriate context to use for this event. $ this -> editorcontext = $ this -> get_context ( ) ; if ( ! calendar_is_valid_eventtype ( $ this -> properties -> eventtype ) ) { // We don't have a context here, do a normal format_text. return external_format_text ( $ this -> properties -> description , $ this -> properties -> format , $ this -> editorcontext -> id ) ; } } // Work out the item id for the editor, if this is a repeated event then the files will be associated with the original. if ( ! empty ( $ this -> properties -> repeatid ) && $ this -> properties -> repeatid > 0 ) { $ itemid = $ this -> properties -> repeatid ; } else { $ itemid = $ this -> properties -> id ; } return external_format_text ( $ this -> properties -> description , $ this -> properties -> format , $ this -> editorcontext -> id , 'calendar' , 'event_description' , $ itemid ) ; }
docstring: Format the text using the external API.
  
  This function should we used when text formatting is required in external functions.
  
  @return array an array containing the text formatted and the text format
docstring_tokens: Format the text using the external API .