original_string: public function data_preprocessing(&$data) {
          if ($this->current->instance) {
              // editing an existing workshop - let us prepare the added editor elements (intro done automatically)
              $draftitemid = file_get_submitted_draft_itemid('instructauthors');
              $data['instructauthorseditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'instructauthors', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['instructauthors']);
              $data['instructauthorseditor']['format'] = $data['instructauthorsformat'];
              $data['instructauthorseditor']['itemid'] = $draftitemid;
  
              $draftitemid = file_get_submitted_draft_itemid('instructreviewers');
              $data['instructreviewerseditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'instructreviewers', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['instructreviewers']);
              $data['instructreviewerseditor']['format'] = $data['instructreviewersformat'];
              $data['instructreviewerseditor']['itemid'] = $draftitemid;
  
              $draftitemid = file_get_submitted_draft_itemid('conclusion');
              $data['conclusioneditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'conclusion', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['conclusion']);
              $data['conclusioneditor']['format'] = $data['conclusionformat'];
              $data['conclusioneditor']['itemid'] = $draftitemid;
              // Set submission type checkboxes.
              foreach (['submissiontypetext', 'submissiontypefile'] as $type) {
                  $data[$type . 'available'] = 1;
                  $data[$type . 'required'] = 0;
                  if ($data[$type] == WORKSHOP_SUBMISSION_TYPE_DISABLED) {
                      $data[$type . 'available'] = 0;
                  } else if ($data[$type] == WORKSHOP_SUBMISSION_TYPE_REQUIRED) {
                      $data[$type . 'required'] = 1;
                  }
              }
          } else {
              // adding a new workshop instance
              $draftitemid = file_get_submitted_draft_itemid('instructauthors');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'instructauthors', 0);    // no context yet, itemid not used
              $data['instructauthorseditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
  
              $draftitemid = file_get_submitted_draft_itemid('instructreviewers');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'instructreviewers', 0);    // no context yet, itemid not used
              $data['instructreviewerseditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
  
              $draftitemid = file_get_submitted_draft_itemid('conclusion');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'conclusion', 0);    // no context yet, itemid not used
              $data['conclusioneditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
          }
      }
code: public function data_preprocessing(&$data) {
          if ($this->current->instance) {
              // editing an existing workshop - let us prepare the added editor elements (intro done automatically)
              $draftitemid = file_get_submitted_draft_itemid('instructauthors');
              $data['instructauthorseditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'instructauthors', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['instructauthors']);
              $data['instructauthorseditor']['format'] = $data['instructauthorsformat'];
              $data['instructauthorseditor']['itemid'] = $draftitemid;
  
              $draftitemid = file_get_submitted_draft_itemid('instructreviewers');
              $data['instructreviewerseditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'instructreviewers', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['instructreviewers']);
              $data['instructreviewerseditor']['format'] = $data['instructreviewersformat'];
              $data['instructreviewerseditor']['itemid'] = $draftitemid;
  
              $draftitemid = file_get_submitted_draft_itemid('conclusion');
              $data['conclusioneditor']['text'] = file_prepare_draft_area($draftitemid, $this->context->id,
                                  'mod_workshop', 'conclusion', 0,
                                  workshop::instruction_editors_options($this->context),
                                  $data['conclusion']);
              $data['conclusioneditor']['format'] = $data['conclusionformat'];
              $data['conclusioneditor']['itemid'] = $draftitemid;
              // Set submission type checkboxes.
              foreach (['submissiontypetext', 'submissiontypefile'] as $type) {
                  $data[$type . 'available'] = 1;
                  $data[$type . 'required'] = 0;
                  if ($data[$type] == WORKSHOP_SUBMISSION_TYPE_DISABLED) {
                      $data[$type . 'available'] = 0;
                  } else if ($data[$type] == WORKSHOP_SUBMISSION_TYPE_REQUIRED) {
                      $data[$type . 'required'] = 1;
                  }
              }
          } else {
              // adding a new workshop instance
              $draftitemid = file_get_submitted_draft_itemid('instructauthors');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'instructauthors', 0);    // no context yet, itemid not used
              $data['instructauthorseditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
  
              $draftitemid = file_get_submitted_draft_itemid('instructreviewers');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'instructreviewers', 0);    // no context yet, itemid not used
              $data['instructreviewerseditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
  
              $draftitemid = file_get_submitted_draft_itemid('conclusion');
              file_prepare_draft_area($draftitemid, null, 'mod_workshop', 'conclusion', 0);    // no context yet, itemid not used
              $data['conclusioneditor'] = array('text' => '', 'format' => editors_get_preferred_format(), 'itemid' => $draftitemid);
          }
      }
code_tokens: public function data_preprocessing ( & $ data ) { if ( $ this -> current -> instance ) { // editing an existing workshop - let us prepare the added editor elements (intro done automatically) $ draftitemid = file_get_submitted_draft_itemid ( 'instructauthors' ) ; $ data [ 'instructauthorseditor' ] [ 'text' ] = file_prepare_draft_area ( $ draftitemid , $ this -> context -> id , 'mod_workshop' , 'instructauthors' , 0 , workshop :: instruction_editors_options ( $ this -> context ) , $ data [ 'instructauthors' ] ) ; $ data [ 'instructauthorseditor' ] [ 'format' ] = $ data [ 'instructauthorsformat' ] ; $ data [ 'instructauthorseditor' ] [ 'itemid' ] = $ draftitemid ; $ draftitemid = file_get_submitted_draft_itemid ( 'instructreviewers' ) ; $ data [ 'instructreviewerseditor' ] [ 'text' ] = file_prepare_draft_area ( $ draftitemid , $ this -> context -> id , 'mod_workshop' , 'instructreviewers' , 0 , workshop :: instruction_editors_options ( $ this -> context ) , $ data [ 'instructreviewers' ] ) ; $ data [ 'instructreviewerseditor' ] [ 'format' ] = $ data [ 'instructreviewersformat' ] ; $ data [ 'instructreviewerseditor' ] [ 'itemid' ] = $ draftitemid ; $ draftitemid = file_get_submitted_draft_itemid ( 'conclusion' ) ; $ data [ 'conclusioneditor' ] [ 'text' ] = file_prepare_draft_area ( $ draftitemid , $ this -> context -> id , 'mod_workshop' , 'conclusion' , 0 , workshop :: instruction_editors_options ( $ this -> context ) , $ data [ 'conclusion' ] ) ; $ data [ 'conclusioneditor' ] [ 'format' ] = $ data [ 'conclusionformat' ] ; $ data [ 'conclusioneditor' ] [ 'itemid' ] = $ draftitemid ; // Set submission type checkboxes. foreach ( [ 'submissiontypetext' , 'submissiontypefile' ] as $ type ) { $ data [ $ type . 'available' ] = 1 ; $ data [ $ type . 'required' ] = 0 ; if ( $ data [ $ type ] == WORKSHOP_SUBMISSION_TYPE_DISABLED ) { $ data [ $ type . 'available' ] = 0 ; } else if ( $ data [ $ type ] == WORKSHOP_SUBMISSION_TYPE_REQUIRED ) { $ data [ $ type . 'required' ] = 1 ; } } } else { // adding a new workshop instance $ draftitemid = file_get_submitted_draft_itemid ( 'instructauthors' ) ; file_prepare_draft_area ( $ draftitemid , null , 'mod_workshop' , 'instructauthors' , 0 ) ; // no context yet, itemid not used $ data [ 'instructauthorseditor' ] = array ( 'text' => '' , 'format' => editors_get_preferred_format ( ) , 'itemid' => $ draftitemid ) ; $ draftitemid = file_get_submitted_draft_itemid ( 'instructreviewers' ) ; file_prepare_draft_area ( $ draftitemid , null , 'mod_workshop' , 'instructreviewers' , 0 ) ; // no context yet, itemid not used $ data [ 'instructreviewerseditor' ] = array ( 'text' => '' , 'format' => editors_get_preferred_format ( ) , 'itemid' => $ draftitemid ) ; $ draftitemid = file_get_submitted_draft_itemid ( 'conclusion' ) ; file_prepare_draft_area ( $ draftitemid , null , 'mod_workshop' , 'conclusion' , 0 ) ; // no context yet, itemid not used $ data [ 'conclusioneditor' ] = array ( 'text' => '' , 'format' => editors_get_preferred_format ( ) , 'itemid' => $ draftitemid ) ; } }
docstring: Prepares the form before data are set
  
  Additional wysiwyg editor are prepared here, the introeditor is prepared automatically by core.
  Grade items are set here because the core modedit supports single grade item only.
  
  @param array $data to be set
  @return void
docstring_tokens: Prepares the form before data are set