public function RenameFolderForm() {
        $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ID'))));
        
        if(!empty($folder) && $folder!==false && $folder->ID!=0) {
            $fields=new FieldList(
                                new TabSet('Root',
                                                new Tab('Main', 'Main',
                                                                        new TextField('Name', _t('SnippetFolder.NAME', '_Name'), null, 150)
                                                                    )
                                            ),
                                new HiddenField('ID', 'ID')
                            );
            
            $actions=new FieldList(
                                    new FormAction('doRenameFolder', _t('CodeBank.SAVE', '_Save'))
                                );
        }else {
            $fields=new FieldList();
            $actions=new FieldList();
        }
        
        $validator=new RequiredFields('Name');
        
        $form=new Form($this, 'RenameFolderForm', $fields, $actions, $validator);
        $form->addExtraClass('member-profile-form');
        
        
        //If no parent disable folder
        if(empty($folder) || $folder===false || $folder->ID==0) {
            $form->setMessage(_t('CodeBank.FOLDER_NOT_FOUND', '_Folder could not be found'), 'bad');
        }else {
            $form->loadDataFrom($folder);
            $form->setFormAction(Controller::join_links($form->FormAction(), '?ID='.$folder->ID));
        }
        
        return $form;
    }
public function RenameFolderForm() {
        $folder=SnippetFolder::get()->byID(intval(str_replace('folder-', '', $this->request->getVar('ID'))));
        
        if(!empty($folder) && $folder!==false && $folder->ID!=0) {
            $fields=new FieldList(
                                new TabSet('Root',
                                                new Tab('Main', 'Main',
                                                                        new TextField('Name', _t('SnippetFolder.NAME', '_Name'), null, 150)
                                                                    )
                                            ),
                                new HiddenField('ID', 'ID')
                            );
            
            $actions=new FieldList(
                                    new FormAction('doRenameFolder', _t('CodeBank.SAVE', '_Save'))
                                );
        }else {
            $fields=new FieldList();
            $actions=new FieldList();
        }
        
        $validator=new RequiredFields('Name');
        
        $form=new Form($this, 'RenameFolderForm', $fields, $actions, $validator);
        $form->addExtraClass('member-profile-form');
        
        
        //If no parent disable folder
        if(empty($folder) || $folder===false || $folder->ID==0) {
            $form->setMessage(_t('CodeBank.FOLDER_NOT_FOUND', '_Folder could not be found'), 'bad');
        }else {
            $form->loadDataFrom($folder);
            $form->setFormAction(Controller::join_links($form->FormAction(), '?ID='.$folder->ID));
        }
        
        return $form;
    }
public function RenameFolderForm ( ) { $ folder = SnippetFolder :: get ( ) -> byID ( intval ( str_replace ( 'folder-' , '' , $ this -> request -> getVar ( 'ID' ) ) ) ) ; if ( ! empty ( $ folder ) && $ folder !== false && $ folder -> ID != 0 ) { $ fields = new FieldList ( new TabSet ( 'Root' , new Tab ( 'Main' , 'Main' , new TextField ( 'Name' , _t ( 'SnippetFolder.NAME' , '_Name' ) , null , 150 ) ) ) , new HiddenField ( 'ID' , 'ID' ) ) ; $ actions = new FieldList ( new FormAction ( 'doRenameFolder' , _t ( 'CodeBank.SAVE' , '_Save' ) ) ) ; } else { $ fields = new FieldList ( ) ; $ actions = new FieldList ( ) ; } $ validator = new RequiredFields ( 'Name' ) ; $ form = new Form ( $ this , 'RenameFolderForm' , $ fields , $ actions , $ validator ) ; $ form -> addExtraClass ( 'member-profile-form' ) ; //If no parent disable folder if ( empty ( $ folder ) || $ folder === false || $ folder -> ID == 0 ) { $ form -> setMessage ( _t ( 'CodeBank.FOLDER_NOT_FOUND' , '_Folder could not be found' ) , 'bad' ) ; } else { $ form -> loadDataFrom ( $ folder ) ; $ form -> setFormAction ( Controller :: join_links ( $ form -> FormAction ( ) , '?ID=' . $ folder -> ID ) ) ; } return $ form ; }
Form used for renaming a folder
@return {Form} Form to be used for renaming a folder
Form used for renaming a folder