nwhiting wrote:
> 
> 
> wenbert wrote:
>> 
>> I have this:
>> <pre>
>>       $elementDecorators = array(
>>             'ViewHelper',
>>             'Errors',
>>             'Description',
>>             array(array('data' => 'HtmlTag'), array('tag' => 'dd',
>> 'class' => 'element')),
>>             array('Label', array('tag' => 'dt'),
>>             array(array('row' => 'HtmlTag'), array('tag' => 'dt')),
>> 
>>        ));
>> 
>>        $this->addElement('text', 'emp_lastname', array(
>>             'decorators' => $this->elementDecorators,
>>             'label'       => 'Employee Lastname:',
>>             'required'   => true,
>>             'attribs' =>   array(
>>                                 'id'=>'emp_lastname',
>>                                 'class'=>'normal_text_box'
>>                             )
>>         ));
>> 
>> IT OUTPUTS SOMETHING LIKE THIS:
>> <dt>
>> <label for="emp_lastname" class="required">Employee Lastname:</label>
>> </dt>
>> <dd class="element">
>> <input type="text" name="emp_lastname" id="emp_lastname" value=""
>> class="normal_text_box" />
>> </dd> 
>> </pre>
>> 
>> Can you explain me how the array $elementDecorator works? Especially the
>> arrays after 'Description'...
>> 
>> Thanks so much!
>> 
>> Regards,
>> Wenbert
>> 
> 
> The way the decorators works is by parsing the options passed in the array
> that is defined by them.
> 
> So the above example the decorator options array is being set to
> 'ViewHelper'  'Errors' and 'Description', you could set your own
> decorators for each by using instead 
> here is a small example to better explain this for you and get you
> started.
> 
> $this->setElementDecorators(array(
>         'ViewHelper',
> 
>         array(
>               array(
>                     'inputOpen' => 'HtmlTag',
>                     ),
>               array('tag' => 'div',
>                     'class' => 'formDataRight',
>                     'openOnly' => true
>                     ),
>               'placement' => Zend_Form_Decorator_Abstract::PREPEND
>               ),
>         array('Description',
>               array(
>                     'placement' => array('inputClose', 'prepend'),
>                     'tag' => 'div',
>                     'class' => 'helpLine')
>               ),
>         array('Errors',
>                 array('tag' => 'div',
>                       'placement' => 'prepend',
>                       'class' => 'helpline'
>                       )
>             ),
> 

Thank you for your reply. I have another question: What is in the 3rd array
after the 'Description'? array(array('row' => 'HtmlTag'), array('tag' =>
'dt')),

I have seen people use "TR"s for table rows in this part. What else can I
pass in the setElementDecorators() function?

Seriously, thanks for the short example you gave above. It is shedding some
light already ;)


-----
http://blog.ekini.net
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-Decorators-explanation-tp20261370p20277468.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to