[development] Question on #theme attribute in D6 FAPI

Darrel O'Pry darrel.opry at gmail.com
Thu Jul 10 06:30:07 UTC 2008

On Wed, Jul 9, 2008 at 9:22 PM, Syscrusher <syscrusher at 4th.com> 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 and the theme layer are not the same... A theme function must be
declared in hook_theme() in order for theme() to call it. FAPI simply calls
theme() with the $element.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080710/9a8de694/attachment.htm 

More information about the development mailing list