public function getSearchForm()
    {
        // Create the fields
        $dateFrom = DateField::create(
            'Search__LastEditedFrom',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM', 'From')
        )->setLocale(Security::getCurrentUser()->Locale);
        $dateTo = DateField::create(
            'Search__LastEditedTo',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATETO', 'To')
        )->setLocale(Security::getCurrentUser()->Locale);
        $filters = CMSSiteTreeFilter::get_all_filters();
        // Remove 'All pages' as we set that to empty/default value
        unset($filters[CMSSiteTreeFilter_Search::class]);
        $pageFilter = DropdownField::create(
            'Search__FilterClass',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGES', 'Page status'),
            $filters
        );
        $pageFilter->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGESALLOPT', 'All pages'));
        $pageClasses = DropdownField::create(
            'Search__ClassName',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEOPT', 'Page type', 'Dropdown for limiting search to a page type'),
            $this->getPageTypes()
        );
        $pageClasses->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEANYOPT', 'Any'));

        // Group the Datefields
        $dateGroup = FieldGroup::create(
            _t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'),
            [$dateFrom, $dateTo]
        )->setName('Search__LastEdited')
        ->addExtraClass('fieldgroup--fill-width');

        // Create the Field list
        $fields = new FieldList(
            $pageFilter,
            $pageClasses,
            $dateGroup
        );

        // Create the form
        /** @skipUpgrade */
        $form = Form::create(
            $this,
            'SearchForm',
            $fields,
            new FieldList()
        );
        $form->addExtraClass('cms-search-form');
        $form->setFormMethod('GET');
        $form->setFormAction(CMSMain::singleton()->Link());
        $form->disableSecurityToken();
        $form->unsetValidator();

        // Load the form with previously sent search data
        $form->loadDataFrom($this->getRequest()->getVars());

        // Allow decorators to modify the form
        $this->extend('updateSearchForm', $form);

        return $form;
    }
public function getSearchForm()
    {
        // Create the fields
        $dateFrom = DateField::create(
            'Search__LastEditedFrom',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM', 'From')
        )->setLocale(Security::getCurrentUser()->Locale);
        $dateTo = DateField::create(
            'Search__LastEditedTo',
            _t('SilverStripe\\CMS\\Search\\SearchForm.FILTERDATETO', 'To')
        )->setLocale(Security::getCurrentUser()->Locale);
        $filters = CMSSiteTreeFilter::get_all_filters();
        // Remove 'All pages' as we set that to empty/default value
        unset($filters[CMSSiteTreeFilter_Search::class]);
        $pageFilter = DropdownField::create(
            'Search__FilterClass',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGES', 'Page status'),
            $filters
        );
        $pageFilter->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGESALLOPT', 'All pages'));
        $pageClasses = DropdownField::create(
            'Search__ClassName',
            _t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEOPT', 'Page type', 'Dropdown for limiting search to a page type'),
            $this->getPageTypes()
        );
        $pageClasses->setEmptyString(_t('SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEANYOPT', 'Any'));

        // Group the Datefields
        $dateGroup = FieldGroup::create(
            _t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'),
            [$dateFrom, $dateTo]
        )->setName('Search__LastEdited')
        ->addExtraClass('fieldgroup--fill-width');

        // Create the Field list
        $fields = new FieldList(
            $pageFilter,
            $pageClasses,
            $dateGroup
        );

        // Create the form
        /** @skipUpgrade */
        $form = Form::create(
            $this,
            'SearchForm',
            $fields,
            new FieldList()
        );
        $form->addExtraClass('cms-search-form');
        $form->setFormMethod('GET');
        $form->setFormAction(CMSMain::singleton()->Link());
        $form->disableSecurityToken();
        $form->unsetValidator();

        // Load the form with previously sent search data
        $form->loadDataFrom($this->getRequest()->getVars());

        // Allow decorators to modify the form
        $this->extend('updateSearchForm', $form);

        return $form;
    }
public function getSearchForm ( ) { // Create the fields $ dateFrom = DateField :: create ( 'Search__LastEditedFrom' , _t ( 'SilverStripe\\CMS\\Search\\SearchForm.FILTERDATEFROM' , 'From' ) ) -> setLocale ( Security :: getCurrentUser ( ) -> Locale ) ; $ dateTo = DateField :: create ( 'Search__LastEditedTo' , _t ( 'SilverStripe\\CMS\\Search\\SearchForm.FILTERDATETO' , 'To' ) ) -> setLocale ( Security :: getCurrentUser ( ) -> Locale ) ; $ filters = CMSSiteTreeFilter :: get_all_filters ( ) ; // Remove 'All pages' as we set that to empty/default value unset ( $ filters [ CMSSiteTreeFilter_Search :: class ] ) ; $ pageFilter = DropdownField :: create ( 'Search__FilterClass' , _t ( 'SilverStripe\\CMS\\Controllers\\CMSMain.PAGES' , 'Page status' ) , $ filters ) ; $ pageFilter -> setEmptyString ( _t ( 'SilverStripe\\CMS\\Controllers\\CMSMain.PAGESALLOPT' , 'All pages' ) ) ; $ pageClasses = DropdownField :: create ( 'Search__ClassName' , _t ( 'SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEOPT' , 'Page type' , 'Dropdown for limiting search to a page type' ) , $ this -> getPageTypes ( ) ) ; $ pageClasses -> setEmptyString ( _t ( 'SilverStripe\\CMS\\Controllers\\CMSMain.PAGETYPEANYOPT' , 'Any' ) ) ; // Group the Datefields $ dateGroup = FieldGroup :: create ( _t ( 'SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING' , 'Last edited' ) , [ $ dateFrom , $ dateTo ] ) -> setName ( 'Search__LastEdited' ) -> addExtraClass ( 'fieldgroup--fill-width' ) ; // Create the Field list $ fields = new FieldList ( $ pageFilter , $ pageClasses , $ dateGroup ) ; // Create the form /** @skipUpgrade */ $ form = Form :: create ( $ this , 'SearchForm' , $ fields , new FieldList ( ) ) ; $ form -> addExtraClass ( 'cms-search-form' ) ; $ form -> setFormMethod ( 'GET' ) ; $ form -> setFormAction ( CMSMain :: singleton ( ) -> Link ( ) ) ; $ form -> disableSecurityToken ( ) ; $ form -> unsetValidator ( ) ; // Load the form with previously sent search data $ form -> loadDataFrom ( $ this -> getRequest ( ) -> getVars ( ) ) ; // Allow decorators to modify the form $ this -> extend ( 'updateSearchForm' , $ form ) ; return $ form ; }
Returns a Form for page searching for use in templates.

Can be modified from a decorator by a 'updateSearchForm' method

@return Form
Returns a Form for page searching for use in templates .