2009年9月25日星期五

Re: [fw-mvc] How To Extend Zend_Form_Element ?

You may be able to do that using the built-in HtmlTag decorator. It allows you to add any number of HTML tags to your element.


--
Hector


On Fri, Sep 25, 2009 at 12:47 PM, Rémi Goyard <rgoyard@gmail.com> wrote:
Hi, 
 Ok, thank you !
 I was creating a decorator for my forms elements to create tooltips for elements description to have something like that
<div class="description">
  <div class="title">tooltip Title</div>
  <div class="message">tooltip message (the description attribute ok the element)</div>
</div>
 But i want the developper to define his own title, so i would like to override the setDescription() method to accept Array or objects parameter.
 The setDescription method in ZF casts the parameter to string so if i pass an array the value of the description attribute is Array.
 Maybe if i use objects and use the __toString() magic method.
 If you have other ideas ... you're welcome !

Rémi

ps : Excuse me for my english !


On Fri, Sep 25, 2009 at 8:33 PM, Hector Virgen <djvirgen@gmail.com> wrote:
Not that I know of. All form elements extends Zend_Form_Element, so you'll either need to update Zend_Form_Element itself or change the class that all elements extend from.

What kind of functionality are you looking to add? Maybe there is another way around this limitation, or maybe it could be useful for other developers and added to the framework itself.

--
Hector



On Fri, Sep 25, 2009 at 10:46 AM, Rémi Goyard <rgoyard@gmail.com> wrote:
Hi,

  I need to add a method to all my form elements so i want to extend the Zend_Form_Element class.
  Is there a way to do that ?

thanks

Rémi



没有评论: