Please. Hold on for a second. (was Re: [development] proposal for
theming nodes)
Adrian Rossouw
adrian at bryght.com
Thu Dec 15 10:50:11 UTC 2005
Now before you guys go off an re-invent the world, please realise
that the forms api
already solves all these problems you guys are trying to solve.
Indeed, it was built to
do output, and it is already in core.
CCK _will_ be using the forms api structure to output nodes in the
future (it makes absolutely no sense to use
2 separate systems, especially since there's a completely flexible
system already in core.), so to future proof your
code .. please think about building on the work that has already been
done for the forms api.
$node->extras['module_something'] = array('#type' => 'form_box,
'#value' => $module->something, '#default_value' => 'lorem ipsum
ferrets and mounties and bubbles and things');
in your theme / template :
<?php form_render($extras['module_something'); ?>
By default render function uses either the order specified, or the
#weight property you add.
The only requirement is that you need to only have 1 parameter for
the theme function (an associative array).
You can re-use any theme function you want by just adding a small
wrapper function, like such :
function theme_form_box($form) {
return theme_box($form['#title'], $form['#value'] . $form
['#children']);
}
In the future, all these wrapper functions will be removed and the
original functions replaced with the new form of parameters
(which makes all the phptemplate_ stub functions obsolete and allow
direct loading of template for any theme function without
having to explicitly overload anything ... AND it makes writing a
cohesive theme editor a fsckload simpler)
You can also just use the markup property if that's what you want.
--
Adrian Rossouw
Drupal developer and Bryght Guy
http://drupal.org | http://bryght.com
More information about the development
mailing list