original_string: protected function add_defaults() {
          $mform =& $this->_form;
          $strrequired = get_string('required');
  
          $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->id : 0);
          $mform->setType('edit', PARAM_INT);
          $mform->addElement('hidden', 'new',   $this->plugin);
          $mform->setType('new', PARAM_ALPHANUMEXT);
          $mform->addElement('hidden', 'plugin', $this->plugin);
          $mform->setType('plugin', PARAM_PLUGIN);
          $mform->addElement('hidden', 'typeid', $this->typeid);
          $mform->setType('typeid', PARAM_INT);
          $mform->addElement('hidden', 'contextid', $this->contextid);
          $mform->setType('contextid', PARAM_INT);
  
          $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"');
          $mform->addRule('name', $strrequired, 'required', null, 'client');
          $mform->setType('name', PARAM_TEXT);
      }
code: protected function add_defaults() {
          $mform =& $this->_form;
          $strrequired = get_string('required');
  
          $mform->addElement('hidden', 'edit',  ($this->instance) ? $this->instance->id : 0);
          $mform->setType('edit', PARAM_INT);
          $mform->addElement('hidden', 'new',   $this->plugin);
          $mform->setType('new', PARAM_ALPHANUMEXT);
          $mform->addElement('hidden', 'plugin', $this->plugin);
          $mform->setType('plugin', PARAM_PLUGIN);
          $mform->addElement('hidden', 'typeid', $this->typeid);
          $mform->setType('typeid', PARAM_INT);
          $mform->addElement('hidden', 'contextid', $this->contextid);
          $mform->setType('contextid', PARAM_INT);
  
          $mform->addElement('text', 'name', get_string('name'), 'maxlength="100" size="30"');
          $mform->addRule('name', $strrequired, 'required', null, 'client');
          $mform->setType('name', PARAM_TEXT);
      }
code_tokens: protected function add_defaults ( ) { $ mform = & $ this -> _form ; $ strrequired = get_string ( 'required' ) ; $ mform -> addElement ( 'hidden' , 'edit' , ( $ this -> instance ) ? $ this -> instance -> id : 0 ) ; $ mform -> setType ( 'edit' , PARAM_INT ) ; $ mform -> addElement ( 'hidden' , 'new' , $ this -> plugin ) ; $ mform -> setType ( 'new' , PARAM_ALPHANUMEXT ) ; $ mform -> addElement ( 'hidden' , 'plugin' , $ this -> plugin ) ; $ mform -> setType ( 'plugin' , PARAM_PLUGIN ) ; $ mform -> addElement ( 'hidden' , 'typeid' , $ this -> typeid ) ; $ mform -> setType ( 'typeid' , PARAM_INT ) ; $ mform -> addElement ( 'hidden' , 'contextid' , $ this -> contextid ) ; $ mform -> setType ( 'contextid' , PARAM_INT ) ; $ mform -> addElement ( 'text' , 'name' , get_string ( 'name' ) , 'maxlength="100" size="30"' ) ; $ mform -> addRule ( 'name' , $ strrequired , 'required' , null , 'client' ) ; $ mform -> setType ( 'name' , PARAM_TEXT ) ; }
docstring: Added defaults to moodle form
docstring_tokens: Added defaults to moodle form