ZF-9010: Erros decorator on Zend_Form when grouped does not translate labels

Issue Type: Sub-task Created: 2010-01-29T04:55:47.000+0000 Last Updated: 2011-10-31T17:29:59.000+0000 Status: Closed Fix version(s): Reporter: Alfons Foubert (precognis) Assignee: Adam Lundrigan (adamlundrigan) Tags: - Zend_Form

Related issues: - ZF-8764



When you want to group the errors decorator on form the labels are not translated.


class Form_BugForm extends Zend_Form { function __construct( $options = NULL ) { parent::__construct($options); $this->setName('formName') ->setMethod('post');

    $element = new Zend_Form_Element_Text('foo');
            ->setLabel('Foo label')


    $this->setDecorators(array('FormElements', 'Form', 'FormErrors'));


Label 'Foo label' is not translated in the FormErrors decorator.

Our solution: (library/Zend/Form/Decorator/FormErrors.php)

public function renderLabel(Zend_Form_Element $element, Zend_View_Interface $view) { $label = $element->getLabel(); if (empty($label)) { $label = $element->getName(); }

    /* We solved the bug with adding this if */
    if (null !== ($translator = $element->getTranslator())) {
        $label = $translator->translate($label);

    return $this->getMarkupElementLabelStart()
         . $view->escape($label)
         . $this->getMarkupElementLabelEnd();


Posted by Adam Lundrigan (adamlundrigan) on 2011-10-31T17:29:59.000+0000

This is a duplicate of ZF-8713

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.