[development] Question on #theme attribute in D6 FAPI
syscrusher at 4th.com
Thu Jul 10 09:32:27 UTC 2008
On Thu, 2008-07-10 at 02:30 -0400, Darrel O'Pry wrote:
> 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.
Ahhhhhh....that helps a LOT. I realized they were separate layers, but I
was under the impression that if I declared
$form[$element]['#theme'] = 'foo'
that the FAPI's drupal_render() would directly call
$html_fragment = them_foo($form[$element])
I understand now that FAPI is using theme(.....) internally rather than
making the direct call. For some reason I just never made the connection
that the FAPI was relying on the actual theme layer rather than just
looking for the function directly.
Are the naming conventions for the functions still the same now? IOW,
should my theming function begin with "theme_my_module_...." or just
with "my_module_.....", as a D6 convention? And is the naming convention
the same for theme functions intended to be called by FAPI as it would
be if the same function were actually part of a theme package?
I want to be sure that by creating module "foo" I am not conflicting
with theme "foo" if someone else were to create that (unlikely, but
better to be safe than sorry, and I want to be a good Drupal citizen).
Thanks again for all the help on this, from all who have replied.
Syscrusher <syscrusher at 4th.com>
More information about the development