Allow Parameters For Formatter

Hi

Extending the formatter to something like:




[size=2]public function format($value,$type)[/size]

    {

        $params=null;

        if(is_array($type)) {

            $params=$type;

            $type=$type['type'];

        }

        $method='format'.$type;

        if(method_exists($this,$method)) {

            if($params===null) {

                return $this->$method($value);

            } else {

                return $this->$method($value,$params);

            }

        } else {

            throw new CException(Yii::t('yii','Unknown type "{type}".',array('{type}'=>$type)));

        }

    }




Would make formating somewhat more flexible by enabling parameters towards the formatter (such as the width of a field, format of a date, images to be used, …).

[I know: I can currently define my own formatter and apply this - something I already do]