code/model/KapostObject.php
public function scaffoldSearchFields($_params=null) {
        $fields=parent::scaffoldSearchFields($_params);
        
        if(!$fields->dataFieldByName('ClassNameNice')) {
            $classMap=ClassInfo::subclassesFor('KapostObject');
            unset($classMap['KapostObject']);
            
            foreach($classMap as $key=>$value) {
                $classMap[$key]=_t($key.'.SINGULARNAME', $value);
            }
            
            $fields->push(DropdownField::create('ClassNameNice', _t('KapostObject.CONTENT_TYPE', '_Content Type'), $classMap)->setEmptyString('('._t('Enum.ANY', 'Any').')'));
        }
        
        return $fields;
    }
public function scaffoldSearchFields($_params=null) {
        $fields=parent::scaffoldSearchFields($_params);
        
        if(!$fields->dataFieldByName('ClassNameNice')) {
            $classMap=ClassInfo::subclassesFor('KapostObject');
            unset($classMap['KapostObject']);
            
            foreach($classMap as $key=>$value) {
                $classMap[$key]=_t($key.'.SINGULARNAME', $value);
            }
            
            $fields->push(DropdownField::create('ClassNameNice', _t('KapostObject.CONTENT_TYPE', '_Content Type'), $classMap)->setEmptyString('('._t('Enum.ANY', 'Any').')'));
        }
        
        return $fields;
    }
public function scaffoldSearchFields ( $ _params = null ) { $ fields = parent :: scaffoldSearchFields ( $ _params ) ; if ( ! $ fields -> dataFieldByName ( 'ClassNameNice' ) ) { $ classMap = ClassInfo :: subclassesFor ( 'KapostObject' ) ; unset ( $ classMap [ 'KapostObject' ] ) ; foreach ( $ classMap as $ key => $ value ) { $ classMap [ $ key ] = _t ( $ key . '.SINGULARNAME' , $ value ) ; } $ fields -> push ( DropdownField :: create ( 'ClassNameNice' , _t ( 'KapostObject.CONTENT_TYPE' , '_Content Type' ) , $ classMap ) -> setEmptyString ( '(' . _t ( 'Enum.ANY' , 'Any' ) . ')' ) ) ; } return $ fields ; }
Ensures the content type appears in the searchable fields
@param array $_params
@return FieldList Form fields to use in searching
Ensures the content type appears in the searchable fields