(on Monday, 29 December 2008, 09:25 AM -0300):
> Hi there
>
> I managed to get this done subclassing Zend_Form and overriding the render()
> method:
It would be better to override the Label decorator by writing your own
as a drop-in replacement. :)
> public function render(Zend_View_Interface $view = null)
> {
> foreach ($this->getElements() as $element) {
> $label = $element->getDecorator('Label');
> if ($label instanceof Zend_Form_Decorator_Label) {
> $label->setOption('requiredSuffix', ' <span>*</span>')
> ->setOption('escape', false);
> }
> }
>
> return parent::render($view);
> }
>
> On Mon, Dec 29, 2008 at 9:11 AM, Zladivliba Voskuy <nospampam@hotmail.fr>
> wrote:
>
> Hey, did you finally managed to find an answer to this problem ? It's an
> interesting question and I haven't found any answer to it.
>
> --
> My zend framework experience... the good, the bad
> http://myzendframeworkexperience.blogspot.com/
>
>
>
> > Hi,
> >
> > Currently I am using
> >
> > $element->getDecorator('label')->setOption('requiredSuffix', ' * ');
> >
> > to add * to required fields.
> >
> > I want to manage the markup from a centrally accessible place. Perhaps,
> > a custom label decorator. If I wish to change the markup to
> > <em>*</em> or to
> > <div class="redAsterisk">*</div>
> > it would be convenient to change it in one place.
> >
> > I just want to add this functionality to the label decorator and leave
> > all else as is.
> >
> > What is the best method to accomplish this? I have seen some people
> > adding * using CSS. I prefer to print the text character * and style it
> > using CSS.
> >
> > It would be much more convenient if the custom decorator can check
> > whether the element isRequired() and then add * to the label. But I
> > can't figure out how to do it.
> >
> > Code examples would be highly appreciated.
> >
> > --
> >
> > With warm regards,
> > Sudheer. S
> > Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net,
> Personal: http://sudheer.net
> >
> >
>
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Organisez une f te en un tour de main : invitation, photos, blog
>
>
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论