Re: HTML_QuickForm2_Renderer: ArrayAccess

From: Date: Sat, 15 May 2010 17:02:45 +0000
Subject: Re: HTML_QuickForm2_Renderer: ArrayAccess
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-30543@lists.php.net to get a copy of this message
Hi Alexey, > Before we go on implementing proxies and stuff, I'd like to > understand what is the benefit of accessing renderer rather than the > result renderer returns? > > e.g. > > $form->render($renderer); > echo $renderer['foo']; > > vs > > $result = $form->render($renderer)->toArray(); > echo $result['foo']; > > ? Benefit for me is that I do not have to call toArray() :) No, the main reason against the array renderer was that the generated array does not allow access to the elements by their ID. It only has a number-based index that does not help anyone. $ar = $form->render(new HTML_QuickForm2_Renderer_Array())->toArray(); $ar['elements'][0]['id'] $ar['elements'][1]['id'] ... That's what bit me here. Since I needed to hack my own renderer because of that problem, I wanted to do it right - without creating an array that contains information which is not used in 50% of my cases. -- Regards/Mit freundlichen Grüßen Christian Weiske -=≡ Geeking around in the name of science since 1982 ≡=-

Attachment: [application/pgp-signature] signature.asc
« previous php.pear.general (#30543) next »