[development] proposal for theming nodes
dopry at thing.net
Wed Dec 14 17:38:48 UTC 2005
On Wed, 2005-12-14 at 17:28 +0100, Jose A. Reyero wrote:
> Bèr Kessels wrote:
> >way too often i have to hack modules or even core (upload) to make it *not*
> >append HTML to $node->body.
> >I think this practice of appending stuff to the body is very bad, since it
> >makes it impossible to add thatdata elsewhere, without duplication.
> Yep, I agree, same problem here
> >I think that teh best option is an additional variable in $node
> >containing structured data added by all the modules.
> >$node->extra->upload could, for example contain that uplaod/attachement table,
> >that is now hardcoded to the body.
I'm in full agreement. posted the same thing on the theme list.
I think node->extra is probably a better name than the node->html i
suggested, but still a little too abstract. Maybe node->rendered since
we are talking about themed output whether its html, xhtml, rss, atom,
> First I would like to insist in that *all html* produced should be
> About this specific issue, I think we could
> a) Just use themeable functions, that can be overridden, like a
> 'theme_upload_node_body' but, anyway, don't store it into node->body,
> but in node->output or similar
> b) Use that $node->extra->upload you propose but maybe better make it an
> array, $node->extra['upload'] so we can use a simple 'implode' at the
> end. Maybe weights could be useful here too
> The ideal would be using both, themeable functions that produce
> structured data, but any of them used separately would just fix the
> problem. However, the way to go, thinking big, would be kind of
> 'generalized form API' that could be useful to build any object -page,
> block, node..- as structured data and then render it to HTML.
I dig this idea, but its not something that I seeing being plausable
ASAP. The quick and dirty $node->extra can be done in the next day or
two and modules can catch up as need be. There output appended to body
will still be displayed, and the concatenated $node->extra can be
appended to $content to emulate the current functionality.
The we can look at weighting module's themed output through the UI at a
later date or moving the functionality to be based on the forms api,
which I'm starting to get the idea is more of a data model than a forms
Just need to agree on what to call this new output property and I'll try
to a make an acceptable patch that is backwards compatible as far as
themes are concerned... I'm guessing its probably just some touch ups on
the default theme_node and theme engines.
Then the modules can be incrementally updated.
Should this be slated for 4.7 or 4.8... I personally consider modules
altering node->body to be a bug, unless they're a filter module.
More information about the development