[dev] Form.php change

Chuck Hagenbuch chuck at horde.org
Wed Mar 26 11:29:59 PST 2003


Quoting Marko Djukic <marko at oblo.com>:

> no, it's not all for Ulaform, actually still trying to figure out the
> bits and pieces i'll need to add for Ulaform. i never liked the eval() and
> the _useTypes to begin with, but since i was in the code thought i'll try
> and fix it up while i'm at it.

Okay.

> .. and the "it doesn't look so bad" is not exactly inspiring. you mean
> it's usable or it's bad but not too bad?

Well, looking at it now, it's a generally useable idea, but I see some
problems. I don't think you get much from caching one of every type being
used, especially since you can't do that for anything with parameters. So
how about:

    function &getType($type, $params = array())
    {
        $type_class = 'Horde_Form_Type_' . $type;
        $type_ob = &new $type_class();
        call_user_func_array(array(&$type_ob, 'init'), $params);

        return $type_ob;
    }

... and calling it as $type = &$this->getType($type, $params). (note that in
addHidden() you don't have a $params in the signature, so either it should
be left out, or defined...)

> no, i don't mind fixing up the other apps using horde_form.

Great!

-chuck

--
Charles Hagenbuch, <chuck at horde.org>
"... It is not more light we need, but more warmth! We die of cold, not of
darkness. It is not the night that kills, but the frost." - Miguel de
Unamuno


More information about the dev mailing list