[development] Code freeze reminder

Frando (Franz Heinzmann) frando at xcite-online.de
Thu Jun 21 19:33:24 UTC 2007


Robin Monks schrieb:
 > Can we get some examples of how it might be used by a themer?
 >
 > Robin

Please see the message I posted a few hours ago. Right now, working with 
#structured arrays is not yet "super-easy", however, it'll be quite 
simple to add a few helper functions, namely show(), hide() and 
render(), to make it "super-easy".

The big problem with node rendering IMO is, that a) we want to give 
themers complete and simple control over how and where stuff is 
displayed and b) we want to give module developers the chance to insert 
their stuff into the nodes.

With structured arrays and these few helper functions we can achieve 
exactly that. By default, render($node) or something like that would 
render all children, one by one below the other. However, all elements 
that are printed elsewhere would be excluded from that, as would be all 
elements hidden via hide().
As I said, see my last mail for another description.

Regards,
frando

P.S. I actually just took a little first step at these functions. They 
are already basially working nicely ..

function hide($path, &$object) {
   $e =& move_to_path($path, $object);
   $e['#printed'] = TRUE;
}

function show($path, &$object, $return = FALSE) {
   $e =& move_to_path($path, $object);
   $e['#printed'] = FALSE;
   if ($return) {
     return drupal_render($e);
   }
   print drupal_render($e);
}

function render(&$object, $return = FALSE) {
   if ($return) {
     return drupal_render($object);
   }
   print drupal_render($object);
}

function &move_to_path($path, &$object) {
   $e = &$object;
   $path = explode('/', $path);
   foreach ($path as $segment) {
     $e = &$e[$segment];
   }
   return $e;
}


> 
> On 6/21/07, *Yves Chedemois* <yched.drupal at free.fr 
> <mailto:yched.drupal at free.fr>> wrote:
> 
>     Please (re-)read Jeff's post above.
>     # prefixed arrays are not FAPI., and match quite precisely what we are
>     trying to achieve here, so let's not ditch the idea out of
>     miscunception :-)
> 
> 
>     Robin Monks a ecrit le 21/06/2007 20:50:
>      > I also disagree with FAPI.  I know how hard that'll be for a non-PHP
>      > developer to use when themeing a site.
>      >
>      > Robin
>      >
> 
> 
> 
> 
> -- 
> Robin Monks
> @ www.civicspacelabs.org <http://www.civicspacelabs.org>
> @ www.gmking.org <http://www.gmking.org>
> 
> Fax: (419) 791-8076
> 
> "Some people, when confronted with a problem, think "I know, I'll use 
> regular expressions." Now they have two problems." ~IRC



More information about the development mailing list