[development] Question on #theme attribute in D6 FAPI
Earl Miles
merlin at logrus.com
Thu Jul 10 01:25:06 UTC 2008
Syscrusher wrote:
> On Wed, 2008-07-09 at 19:48 -0400, Darrel O'Pry wrote:
>> Did you add the #theme function to hook_theme? #theme should work the
>> same. I don't believe there were any changes to how it is handled in
>> drupal_render.
>
> Thanks for the quick reply, but now I'm confused. With regard to
> registering my theme function, no, I didn't realize I needed to do that.
> Is this necessary for the FAPI to call a theme function that is
> referenced in the $form array? IOW, just declaring the function in the
> $form array doesn't imply that it should be called?
>
> I went to the hook_theme documentation, but I'm unclear on how those
> registration parameters apply to FAPI clients; the documentation seems
> to speak from the viewpoint of the theme writer. I'm not writing a
> theme, just needing to wrap form elements into a table from the
> drupal_render() call. I embed class and ID attributes in the table which
> the theme can modify for aesthetics -- IOW, my module only applies the
> document structure elements without regard to their cosmetics at display
> time.
>
> Am I taking the wrong approach to this?
FAPI doesn't talk to the theme layer, and because there is no form
registration, it can't do that for you. This is something I'd like to
see changed in the future, since it is actually not at all difficult to
figure out what forms are available if we just add a tiny bit of code.
All form themes have exactly one argument, so:
'arguments' => array('element' => NULL),
More information about the development
mailing list