public function SearchForm() {
        $languages=SnippetLanguage::get()
                                        ->leftJoin('Snippet', '"Snippet"."LanguageID"="SnippetLanguage"."ID"')
                                        ->where('"SnippetLanguage"."Hidden"=0 OR "Snippet"."ID" IS NOT NULL')
                                        ->sort('Name');
        
        $fields=new FieldList(
                            new TextField('q[Term]', _t('CodeBank.KEYWORD', '_Keyword')),
                            $classDropdown=new DropdownField(
                                                            'q[LanguageID]',
                                                            _t('CodeBank.LANGUAGE', '_Language'),
                                                            $languages->map('ID', 'Name')
                                                        )
                        );
        
        
        $classDropdown->setEmptyString(_t('CodeBank.ALL_LANGUAGES', '_All Languages'));
        
        
        $actions=new FieldList(
                            FormAction::create('doSearch', _t('CodeBank.APPLY_FILTER', '_Apply Filter'))->setUseButtonTag(true)
                        );
        
        
        $form=Form::create($this, 'SearchForm', $fields, $actions)
                                                                ->addExtraClass('cms-search-form')
                                                                ->setFormMethod('GET')
                                                                ->setFormAction($this->Link())
                                                                ->disableSecurityToken()
                                                                ->unsetValidator();
        $form->loadDataFrom($this->request->getVars());
    
        $this->extend('updateSearchForm', $form);
        return $form;
    }
public function SearchForm() {
        $languages=SnippetLanguage::get()
                                        ->leftJoin('Snippet', '"Snippet"."LanguageID"="SnippetLanguage"."ID"')
                                        ->where('"SnippetLanguage"."Hidden"=0 OR "Snippet"."ID" IS NOT NULL')
                                        ->sort('Name');
        
        $fields=new FieldList(
                            new TextField('q[Term]', _t('CodeBank.KEYWORD', '_Keyword')),
                            $classDropdown=new DropdownField(
                                                            'q[LanguageID]',
                                                            _t('CodeBank.LANGUAGE', '_Language'),
                                                            $languages->map('ID', 'Name')
                                                        )
                        );
        
        
        $classDropdown->setEmptyString(_t('CodeBank.ALL_LANGUAGES', '_All Languages'));
        
        
        $actions=new FieldList(
                            FormAction::create('doSearch', _t('CodeBank.APPLY_FILTER', '_Apply Filter'))->setUseButtonTag(true)
                        );
        
        
        $form=Form::create($this, 'SearchForm', $fields, $actions)
                                                                ->addExtraClass('cms-search-form')
                                                                ->setFormMethod('GET')
                                                                ->setFormAction($this->Link())
                                                                ->disableSecurityToken()
                                                                ->unsetValidator();
        $form->loadDataFrom($this->request->getVars());
    
        $this->extend('updateSearchForm', $form);
        return $form;
    }
public function SearchForm ( ) { $ languages = SnippetLanguage :: get ( ) -> leftJoin ( 'Snippet' , '"Snippet"."LanguageID"="SnippetLanguage"."ID"' ) -> where ( '"SnippetLanguage"."Hidden"=0 OR "Snippet"."ID" IS NOT NULL' ) -> sort ( 'Name' ) ; $ fields = new FieldList ( new TextField ( 'q[Term]' , _t ( 'CodeBank.KEYWORD' , '_Keyword' ) ) , $ classDropdown = new DropdownField ( 'q[LanguageID]' , _t ( 'CodeBank.LANGUAGE' , '_Language' ) , $ languages -> map ( 'ID' , 'Name' ) ) ) ; $ classDropdown -> setEmptyString ( _t ( 'CodeBank.ALL_LANGUAGES' , '_All Languages' ) ) ; $ actions = new FieldList ( FormAction :: create ( 'doSearch' , _t ( 'CodeBank.APPLY_FILTER' , '_Apply Filter' ) ) -> setUseButtonTag ( true ) ) ; $ form = Form :: create ( $ this , 'SearchForm' , $ fields , $ actions ) -> addExtraClass ( 'cms-search-form' ) -> setFormMethod ( 'GET' ) -> setFormAction ( $ this -> Link ( ) ) -> disableSecurityToken ( ) -> unsetValidator ( ) ; $ form -> loadDataFrom ( $ this -> request -> getVars ( ) ) ; $ this -> extend ( 'updateSearchForm' , $ form ) ; return $ form ; }
Generates the search form
@return {Form} Form used for searching
Generates the search form