On 9/29/2009 8:51 AM, Саша Стаменковић wrote:
I need something like addElementDecorators() :D

Regards,
Saša Stamenković


On Tue, Sep 29, 2009 at 3:46 PM, umpirsky <umpir...@gmail.com <mailto:umpir...@gmail.com>> wrote:


    Hi.

    I'm trying to do the following thing.

    I have some form, and I'm putting elements on it one by one, when
    I finish,
    I call setElementDecorators() to customize rendering. That works
    perfect,
    but now I want to add decorator to 3rd element, but
    setElementDecorators()
    owerwrites them, if I call setElementDecorators before adding
    elements, it
    takes no effect!

    How can I achieve this without setting decorators for each element
    one by
    one?

    Regards,
    Sasa Stamenkovic.
    --
    View this message in context:
    http://www.nabble.com/Decorators-again-tp25663367p25663367.html
    Sent from the Zend Framework mailing list archive at Nabble.com.


See http://devzone.zend.com/article/3450. Specifically,

"Unfortunately, there are not currently methods for inserting decorators at specific locations in the decorator stack, so if you find you need to insert a new decorator in the middle of the stack, the best way is to simply reset the stack. For example, if you wanted to add a Description following the element (perhaps a paragraph detailing the purpose of the element), you could do the following:

$element->setDescription($desc);
$element->setDecorators(array(
    'ViewHelper',
    'Description',
    'Errors',
    array('HtmlTag', array('tag' =>  'dd')),
    array('Label', array('tag' =>  'dt')),
));

While |addDecorator()| and |addDecorators()| methods exist, typically you will be using |setDecorators()| unless you start out with very minimal decorators to begin with."

--
Kyle Spraggs (SpiffyJr)
http://www.spiffyjr.me

Reply via email to