[development] a tip for module developers writing forms

Karoly Negyesi karoly at negyesi.net
Mon Dec 19 09:55:23 UTC 2005


Hi!


If you want to make your life easier, while debugging you change:

   // Recurse through all child elements.
   $count  = 0;
   foreach (element_children($form) as $key) {

to

   // Recurse through all child elements.
   $count  = 0;
   foreach (element_children($form) as $key) {
     if (!is_array($form[$key])) die "the form has a wrong key $key";

this way, if you miss a # from a property name, you will get some  
immediate feedback. As it harms performance a bit and is not something  
that can happen with a 'ready' site, I see no point in adding this in any  
way to form.inc.

If someone has an idea on where to add this to some docs, do so.

Regards

NK


More information about the development mailing list