original_string: public function definition() {
          $form = $this->_form;
  
          $form->addElement('hidden', 'areaid');
          $form->setType('areaid', PARAM_INT);
  
          $form->addElement('hidden', 'returnurl');
          $form->setType('returnurl', PARAM_LOCALURL);
  
          // Name.
          $form->addElement('text', 'name', get_string('name', 'gradingform_guide'),
              array('size' => 52, 'maxlength' => 255));
          $form->addRule('name', get_string('required'), 'required', null, 'client');
          $form->setType('name', PARAM_TEXT);
          $form->addRule('name', null, 'maxlength', 255, 'client');
  
          // Description.
          $options = gradingform_guide_controller::description_form_field_options($this->_customdata['context']);
          $form->addElement('editor', 'description_editor', get_string('description'), null, $options);
          $form->setType('description_editor', PARAM_RAW);
  
          // Guide completion status.
          $choices = array();
          $choices[gradingform_controller::DEFINITION_STATUS_DRAFT]    = html_writer::tag('span',
              get_string('statusdraft', 'core_grading'), array('class' => 'status draft'));
          $choices[gradingform_controller::DEFINITION_STATUS_READY]    = html_writer::tag('span',
              get_string('statusready', 'core_grading'), array('class' => 'status ready'));
          $form->addElement('select', 'status', get_string('guidestatus', 'gradingform_guide'), $choices)->freeze();
  
          // Guide editor.
          $element = $form->addElement('guideeditor', 'guide', get_string('pluginname', 'gradingform_guide'));
          $form->setType('guide', PARAM_RAW);
  
          $buttonarray = array();
          $buttonarray[] = &$form->createElement('submit', 'saveguide', get_string('saveguide', 'gradingform_guide'));
          if ($this->_customdata['allowdraft']) {
              $buttonarray[] = &$form->createElement('submit', 'saveguidedraft', get_string('saveguidedraft', 'gradingform_guide'));
          }
          $editbutton = &$form->createElement('submit', 'editguide', ' ');
          $editbutton->freeze();
          $buttonarray[] = &$editbutton;
          $buttonarray[] = &$form->createElement('cancel');
          $form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
          $form->closeHeaderBefore('buttonar');
      }
code: public function definition() {
          $form = $this->_form;
  
          $form->addElement('hidden', 'areaid');
          $form->setType('areaid', PARAM_INT);
  
          $form->addElement('hidden', 'returnurl');
          $form->setType('returnurl', PARAM_LOCALURL);
  
          // Name.
          $form->addElement('text', 'name', get_string('name', 'gradingform_guide'),
              array('size' => 52, 'maxlength' => 255));
          $form->addRule('name', get_string('required'), 'required', null, 'client');
          $form->setType('name', PARAM_TEXT);
          $form->addRule('name', null, 'maxlength', 255, 'client');
  
          // Description.
          $options = gradingform_guide_controller::description_form_field_options($this->_customdata['context']);
          $form->addElement('editor', 'description_editor', get_string('description'), null, $options);
          $form->setType('description_editor', PARAM_RAW);
  
          // Guide completion status.
          $choices = array();
          $choices[gradingform_controller::DEFINITION_STATUS_DRAFT]    = html_writer::tag('span',
              get_string('statusdraft', 'core_grading'), array('class' => 'status draft'));
          $choices[gradingform_controller::DEFINITION_STATUS_READY]    = html_writer::tag('span',
              get_string('statusready', 'core_grading'), array('class' => 'status ready'));
          $form->addElement('select', 'status', get_string('guidestatus', 'gradingform_guide'), $choices)->freeze();
  
          // Guide editor.
          $element = $form->addElement('guideeditor', 'guide', get_string('pluginname', 'gradingform_guide'));
          $form->setType('guide', PARAM_RAW);
  
          $buttonarray = array();
          $buttonarray[] = &$form->createElement('submit', 'saveguide', get_string('saveguide', 'gradingform_guide'));
          if ($this->_customdata['allowdraft']) {
              $buttonarray[] = &$form->createElement('submit', 'saveguidedraft', get_string('saveguidedraft', 'gradingform_guide'));
          }
          $editbutton = &$form->createElement('submit', 'editguide', ' ');
          $editbutton->freeze();
          $buttonarray[] = &$editbutton;
          $buttonarray[] = &$form->createElement('cancel');
          $form->addGroup($buttonarray, 'buttonar', '', array(' '), false);
          $form->closeHeaderBefore('buttonar');
      }
code_tokens: public function definition ( ) { $ form = $ this -> _form ; $ form -> addElement ( 'hidden' , 'areaid' ) ; $ form -> setType ( 'areaid' , PARAM_INT ) ; $ form -> addElement ( 'hidden' , 'returnurl' ) ; $ form -> setType ( 'returnurl' , PARAM_LOCALURL ) ; // Name. $ form -> addElement ( 'text' , 'name' , get_string ( 'name' , 'gradingform_guide' ) , array ( 'size' => 52 , 'maxlength' => 255 ) ) ; $ form -> addRule ( 'name' , get_string ( 'required' ) , 'required' , null , 'client' ) ; $ form -> setType ( 'name' , PARAM_TEXT ) ; $ form -> addRule ( 'name' , null , 'maxlength' , 255 , 'client' ) ; // Description. $ options = gradingform_guide_controller :: description_form_field_options ( $ this -> _customdata [ 'context' ] ) ; $ form -> addElement ( 'editor' , 'description_editor' , get_string ( 'description' ) , null , $ options ) ; $ form -> setType ( 'description_editor' , PARAM_RAW ) ; // Guide completion status. $ choices = array ( ) ; $ choices [ gradingform_controller :: DEFINITION_STATUS_DRAFT ] = html_writer :: tag ( 'span' , get_string ( 'statusdraft' , 'core_grading' ) , array ( 'class' => 'status draft' ) ) ; $ choices [ gradingform_controller :: DEFINITION_STATUS_READY ] = html_writer :: tag ( 'span' , get_string ( 'statusready' , 'core_grading' ) , array ( 'class' => 'status ready' ) ) ; $ form -> addElement ( 'select' , 'status' , get_string ( 'guidestatus' , 'gradingform_guide' ) , $ choices ) -> freeze ( ) ; // Guide editor. $ element = $ form -> addElement ( 'guideeditor' , 'guide' , get_string ( 'pluginname' , 'gradingform_guide' ) ) ; $ form -> setType ( 'guide' , PARAM_RAW ) ; $ buttonarray = array ( ) ; $ buttonarray [ ] = & $ form -> createElement ( 'submit' , 'saveguide' , get_string ( 'saveguide' , 'gradingform_guide' ) ) ; if ( $ this -> _customdata [ 'allowdraft' ] ) { $ buttonarray [ ] = & $ form -> createElement ( 'submit' , 'saveguidedraft' , get_string ( 'saveguidedraft' , 'gradingform_guide' ) ) ; } $ editbutton = & $ form -> createElement ( 'submit' , 'editguide' , ' ' ) ; $ editbutton -> freeze ( ) ; $ buttonarray [ ] = & $ editbutton ; $ buttonarray [ ] = & $ form -> createElement ( 'cancel' ) ; $ form -> addGroup ( $ buttonarray , 'buttonar' , '' , array ( ' ' ) , false ) ; $ form -> closeHeaderBefore ( 'buttonar' ) ; }
docstring: Form element definition
docstring_tokens: Form element definition