[dev] Template or RENDERER for dynamic forms?
Robin Rainton
robin at rainton.com
Thu Dec 8 16:45:17 PST 2005
You know when you say you really should do one thing, but you just can't leave
the other alone? ;)
I was thinking that the several inputs I wanted on one line could be done as a
new type of variable, and that would suit quiet nicely. In the fosdem
presentation it says of types, "Not enough? Add your own ones." so away we
go...
One can add a new type into a form easily by doing this, which can be done in
your own code (I put in an include):
class Horde_Form_Type_newvariabletype extends Horde_Form_Type {
/* Some stuff for this type */
}
Trouble is, the VarRenderer doesn't know how to draw this, and from what I can
see cannot be extended in a separate file. Given the fosdem slide think I've
missed something here because I could only make it work by doing adding
this to
Horde/UI/VarRenderer/html.php:
function _renderVarInput_newvariabletype(&$form, &$var, &$vars)
{
/* Some stuff to return the the inputs */
}
function _renderVarDisplay_newvariabletype(&$form, &$var, &$vars)
{
/* Some stuff to return displayed data */
}
I'm not so great with this stuff, but seems to avoid the edit one would
have to
extend the Horde_UI_VarRenderer and Horde_UI_VarRenderer_html classes
with your
own extension and somehow get them (your own) referenced in
Horde/Variables.php
(or would you have to extend that too?).
That seems awfully complicated, so guess I'm asking, what's the right
way to do
that, "Not enough? Add your own ones." step?
Robin
Quoting Robin Rainton <robin at rainton.com>:
> Ah.... I had a look in there and couldn't find anything but the matrix,
> and then discovered that is also in the main Form class.
>
> OK, so I see there is something here that can be built upon. Basically -
> looks like it will be possible with the renderer, even if one has to
> extend that class oneself ;)
>
> Think I should stop worrying about aesthetics for a while and sort the
> main guts of this thing out first!
>
> Thx again,
>
> Robin
>
> Jan Schneider wrote:
>
>> You might also want to take a look at the Horde_Form library in the
>> incubator CVS module. Maybe this has better support for it.
>>
>> Jan.
>>
>>
>>
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
More information about the dev
mailing list