original_string: public function AddFolderForm() {
          $fields=new FieldList(
                              new TabSet('Root',
                                              new Tab('Main', 'Main',
                                                                      new TextField('Name', _t('SnippetFolder.NAME', '_Name'), null, 150)
                                                                  )
                                          )
                          );
          
          
          $noParent=true;
          if(strpos($this->request->getVar('ParentID'), 'language-')!==false) {
              $fields->push(new HiddenField('LanguageID', 'LanguageID', intval(str_replace('language-', '', $this->request->getVar('ParentID')))));
              
              $noParent=false;
          }else if(strpos($this->request->getVar('ParentID'), 'folder-')!==false) {
              $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ParentID'))));
              
              if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                  $fields->push(new HiddenField('ParentID', 'ParentID', $folder->ID));
                  $fields->push(new HiddenField('LanguageID', 'LanguageID', $folder->LanguageID));
                  
                  $noParent=false;
              }
          }else {
              if($this->request->postVar('LanguageID')) {
                  $fields->push(new HiddenField('LanguageID', 'LanguageID', intval($this->request->postVar('LanguageID'))));
                  
                  $noParent=false;
              }
                 
              if($this->request->postVar('ParentID')) {
                  $fields->push(new HiddenField('ParentID', 'ParentID', intval($this->request->postVar('ParentID'))));
                  
                  $noParent=false;
              }
          }
          
          
          $actions=new FieldList(
                                  new FormAction('doAddFolder', _t('CodeBank.SAVE', '_Save'))
                              );
          
          $validator=new RequiredFields('Name');
          
          $form=new Form($this, 'AddFolderForm', $fields, $actions, $validator);
          $form->addExtraClass('member-profile-form');
          
          
          //If no parent disable folder
          if($noParent) {
              $form->setMessage(_t('CodeBank.FOLDER_NO_PARENT', '_Folder does not have a parent language or folder'), 'bad');
              $form->setFields(new FieldList());
              $form->setActions(new FieldList());
          }
          
          return $form;
      }
code: public function AddFolderForm() {
          $fields=new FieldList(
                              new TabSet('Root',
                                              new Tab('Main', 'Main',
                                                                      new TextField('Name', _t('SnippetFolder.NAME', '_Name'), null, 150)
                                                                  )
                                          )
                          );
          
          
          $noParent=true;
          if(strpos($this->request->getVar('ParentID'), 'language-')!==false) {
              $fields->push(new HiddenField('LanguageID', 'LanguageID', intval(str_replace('language-', '', $this->request->getVar('ParentID')))));
              
              $noParent=false;
          }else if(strpos($this->request->getVar('ParentID'), 'folder-')!==false) {
              $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ParentID'))));
              
              if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                  $fields->push(new HiddenField('ParentID', 'ParentID', $folder->ID));
                  $fields->push(new HiddenField('LanguageID', 'LanguageID', $folder->LanguageID));
                  
                  $noParent=false;
              }
          }else {
              if($this->request->postVar('LanguageID')) {
                  $fields->push(new HiddenField('LanguageID', 'LanguageID', intval($this->request->postVar('LanguageID'))));
                  
                  $noParent=false;
              }
                 
              if($this->request->postVar('ParentID')) {
                  $fields->push(new HiddenField('ParentID', 'ParentID', intval($this->request->postVar('ParentID'))));
                  
                  $noParent=false;
              }
          }
          
          
          $actions=new FieldList(
                                  new FormAction('doAddFolder', _t('CodeBank.SAVE', '_Save'))
                              );
          
          $validator=new RequiredFields('Name');
          
          $form=new Form($this, 'AddFolderForm', $fields, $actions, $validator);
          $form->addExtraClass('member-profile-form');
          
          
          //If no parent disable folder
          if($noParent) {
              $form->setMessage(_t('CodeBank.FOLDER_NO_PARENT', '_Folder does not have a parent language or folder'), 'bad');
              $form->setFields(new FieldList());
              $form->setActions(new FieldList());
          }
          
          return $form;
      }
code_tokens: public function AddFolderForm ( ) { $ fields = new FieldList ( new TabSet ( 'Root' , new Tab ( 'Main' , 'Main' , new TextField ( 'Name' , _t ( 'SnippetFolder.NAME' , '_Name' ) , null , 150 ) ) ) ) ; $ noParent = true ; if ( strpos ( $ this -> request -> getVar ( 'ParentID' ) , 'language-' ) !== false ) { $ fields -> push ( new HiddenField ( 'LanguageID' , 'LanguageID' , intval ( str_replace ( 'language-' , '' , $ this -> request -> getVar ( 'ParentID' ) ) ) ) ) ; $ noParent = false ; } else if ( strpos ( $ this -> request -> getVar ( 'ParentID' ) , 'folder-' ) !== false ) { $ folder = SnippetFolder :: get ( ) -> byID ( intval ( str_replace ( 'folder-' , '' , $ this -> request -> getVar ( 'ParentID' ) ) ) ) ; if ( ! empty ( $ folder ) && $ folder !== false && $ folder -> ID != 0 ) { $ fields -> push ( new HiddenField ( 'ParentID' , 'ParentID' , $ folder -> ID ) ) ; $ fields -> push ( new HiddenField ( 'LanguageID' , 'LanguageID' , $ folder -> LanguageID ) ) ; $ noParent = false ; } } else { if ( $ this -> request -> postVar ( 'LanguageID' ) ) { $ fields -> push ( new HiddenField ( 'LanguageID' , 'LanguageID' , intval ( $ this -> request -> postVar ( 'LanguageID' ) ) ) ) ; $ noParent = false ; } if ( $ this -> request -> postVar ( 'ParentID' ) ) { $ fields -> push ( new HiddenField ( 'ParentID' , 'ParentID' , intval ( $ this -> request -> postVar ( 'ParentID' ) ) ) ) ; $ noParent = false ; } } $ actions = new FieldList ( new FormAction ( 'doAddFolder' , _t ( 'CodeBank.SAVE' , '_Save' ) ) ) ; $ validator = new RequiredFields ( 'Name' ) ; $ form = new Form ( $ this , 'AddFolderForm' , $ fields , $ actions , $ validator ) ; $ form -> addExtraClass ( 'member-profile-form' ) ; //If no parent disable folder if ( $ noParent ) { $ form -> setMessage ( _t ( 'CodeBank.FOLDER_NO_PARENT' , '_Folder does not have a parent language or folder' ) , 'bad' ) ; $ form -> setFields ( new FieldList ( ) ) ; $ form -> setActions ( new FieldList ( ) ) ; } return $ form ; }
docstring: Form used for adding a folder
  @return {Form} Form to be used for adding a folder
docstring_tokens: Form used for adding a folder