mattclegg/remodeladmin

getSearchFields() method is not SS3.0.5 compatible.

Opened this issue · 1 comments

here is my codes:

public function getSearchFields()
{
$fields = ($this->fields) ? $this->fields : singleton($this->modelClass)->scaffoldSearchFields();
if ($fields) {
$dates = array();
foreach ($fields as $f) {

           /* $type = singleton($this->modelClass)->obj($f->getName())->class;
            echo $type . '..'. $f->getName(). '.. '. $f->class.'<br/>';
            if ($type == "Date" || $type == "SS_Datetime") {
                $dates[] = $f;
            }*/
            $type = $f->class ;

            if($type =='DateField' || $type =='DatetimeField'){
                $dates[] = $f;
            }


        }
        foreach ($dates as $d) {
            $fields->removeByName($d->getName());



            $fields->push($a = new DateField( str_replace(']', '_min]', $d->getName() ), $d->Title() . " (" . _t('DateRange.START', 'start') . ")"));
            $fields->push($b = new DateField( str_replace(']', '_max]', $d->getName() ), $d->Title() . " (" . _t('DateRange.END', 'end') . ")"));
            $a->setConfig('showcalendar', true);
            $b->setConfig('showcalendar', true);
            $a->setConfig('dateformat', 'yyyy-MM-dd');
            $b->setConfig('dateformat', 'yyyy-MM-dd');
        }
    }
    return $fields;
}

Can you send this as a pull request?