src/Forms/GridField/GridFieldFilterHeader.php
public function getHTMLFragments($gridField)
    {
        $forTemplate = new ArrayData([]);

        if (!$this->canFilterAnyColumns($gridField)) {
            return null;
        }

        if ($this->useLegacyFilterHeader) {
            $fieldsList = $this->getLegacyFilterHeader($gridField);
            $forTemplate->Fields = $fieldsList;
            $filterTemplates = SSViewer::get_templates_by_class($this, '_Row', __CLASS__);
            return ['header' => $forTemplate->renderWith($filterTemplates)];
        } else {
            $fieldSchema = $this->getSearchFieldSchema($gridField);
            $forTemplate->SearchFieldSchema = $fieldSchema;
            $searchTemplates = SSViewer::get_templates_by_class($this, '_Search', __CLASS__);
            return [
                'before' => $forTemplate->renderWith($searchTemplates),
                'buttons-before-right' => sprintf(
                    '<button type="button" name="showFilter" aria-label="%s" title="%s"' .
                    ' class="btn btn-secondary font-icon-search btn--no-text btn--icon-large grid-field__filter-open"></button>',
                    _t('SilverStripe\\Forms\\GridField\\GridField.OpenFilter', "Open search and filter"),
                    _t('SilverStripe\\Forms\\GridField\\GridField.OpenFilter', "Open search and filter")
                )
            ];
        }
    }
public function getHTMLFragments($gridField)
    {
        $forTemplate = new ArrayData([]);

        if (!$this->canFilterAnyColumns($gridField)) {
            return null;
        }

        if ($this->useLegacyFilterHeader) {
            $fieldsList = $this->getLegacyFilterHeader($gridField);
            $forTemplate->Fields = $fieldsList;
            $filterTemplates = SSViewer::get_templates_by_class($this, '_Row', __CLASS__);
            return ['header' => $forTemplate->renderWith($filterTemplates)];
        } else {
            $fieldSchema = $this->getSearchFieldSchema($gridField);
            $forTemplate->SearchFieldSchema = $fieldSchema;
            $searchTemplates = SSViewer::get_templates_by_class($this, '_Search', __CLASS__);
            return [
                'before' => $forTemplate->renderWith($searchTemplates),
                'buttons-before-right' => sprintf(
                    '<button type="button" name="showFilter" aria-label="%s" title="%s"' .
                    ' class="btn btn-secondary font-icon-search btn--no-text btn--icon-large grid-field__filter-open"></button>',
                    _t('SilverStripe\\Forms\\GridField\\GridField.OpenFilter', "Open search and filter"),
                    _t('SilverStripe\\Forms\\GridField\\GridField.OpenFilter', "Open search and filter")
                )
            ];
        }
    }
public function getHTMLFragments ( $ gridField ) { $ forTemplate = new ArrayData ( [ ] ) ; if ( ! $ this -> canFilterAnyColumns ( $ gridField ) ) { return null ; } if ( $ this -> useLegacyFilterHeader ) { $ fieldsList = $ this -> getLegacyFilterHeader ( $ gridField ) ; $ forTemplate -> Fields = $ fieldsList ; $ filterTemplates = SSViewer :: get_templates_by_class ( $ this , '_Row' , __CLASS__ ) ; return [ 'header' => $ forTemplate -> renderWith ( $ filterTemplates ) ] ; } else { $ fieldSchema = $ this -> getSearchFieldSchema ( $ gridField ) ; $ forTemplate -> SearchFieldSchema = $ fieldSchema ; $ searchTemplates = SSViewer :: get_templates_by_class ( $ this , '_Search' , __CLASS__ ) ; return [ 'before' => $ forTemplate -> renderWith ( $ searchTemplates ) , 'buttons-before-right' => sprintf ( '<button type="button" name="showFilter" aria-label="%s" title="%s"' . ' class="btn btn-secondary font-icon-search btn--no-text btn--icon-large grid-field__filter-open"></button>' , _t ( 'SilverStripe\\Forms\\GridField\\GridField.OpenFilter' , "Open search and filter" ) , _t ( 'SilverStripe\\Forms\\GridField\\GridField.OpenFilter' , "Open search and filter" ) ) ] ; } }
Either returns the legacy filter header or the search button and field

@param GridField $gridField
@return array|null
Either returns the legacy filter header or the search button and field