2008年12月12日星期五

Re: [fw-mvc] Zend_Form rendering enhancement proposal

-- Emanuele Deserti <emanuele.deserti@netwing.it> wrote
(on Friday, 12 December 2008, 12:13 PM +0100):
> It's just me or in the ZF 1.7.0 the method renderElement() will raise an
> Exception?

renderElement() has never existed. In 1.6.0, we added __call() to
Zend_Form_Element, and have it capturing methods that start with
'render'; if the remainder of the method name matches an attached
decorator, it then renders that decorator. If it doesn't match, then an
exception is thrown.

> I've just found that, instead, using renderViewHelper() will work
> correctly (even for dijit elements)

That *shouldn't* work for Dijits -- they don't have that decorator by
default. I've also just verified this, by the way -- an exception was
thrown. Are you by any chance attaching the ViewHelper decorator to your
dijit elements?


> Il giorno 07/mag/08, alle ore 14:32, Matthew Weier O'Phinney ha scritto:
>
>> A number of users have reported that they'd like syntax like the
>> following in Zend_Form:
>>
>> <table>
>> <tr>
>> <td><?= $this->form->foo->renderLabel() ?></td>
>> <td>
>> <?= $this->form->foo->renderElement() ?>
>> <?= $this->form->foo->renderDescription() ?>
>> <?= $this->form->foo->renderErrors() ?>
>> </td>
>> </tr>
>> </table>
>>
>> The idea is that they would like to selectively render specific
>> metadata
>> from the element or form.
>>
>> This could be done fairly easily by using overloading. __call() could
>> intercept methods beginning in 'render', and if the remainder of the
>> method matches a decorator, would render that decorator.
>>
>> I've created an issue to track this, and you can view it at:
>>
>> http://framework.zend.com/issues/browse/ZF-3217
>>
>> Please comment, if you are interested in the idea.
>>
>> --
>> Matthew Weier O'Phinney
>> Software Architect | matthew@zend.com
>> Zend - The PHP Company | http://www.zend.com/
>>
>
> ---
> Emanuele Deserti
> Netwing S.r.l.
> <emanuele.deserti@netwing.it>
> Tel. 0532-1915183
> http://www.netwing.it
>

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: