Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow FormElementErrors view helper to translate messages #4854

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

RalfEggert commented Jul 19, 2013

Allow FormElementErrors view helper to translate messages

Please ignore PRs 4671 and 4672

Contributor

RalfEggert commented Jul 19, 2013

@weierophinney weierophinney commented on the diff Jul 19, 2013

library/Zend/Form/View/Helper/FormElementErrors.php
@@ -78,9 +78,15 @@ public function render(ElementInterface $element, array $attributes = array())
// Flatten message array
$escapeHtml = $this->getEscapeHtmlHelper();
$messagesToPrint = array();
- array_walk_recursive($messages, function ($item) use (&$messagesToPrint, $escapeHtml) {
- $messagesToPrint[] = $escapeHtml($item);
- });
+ $self = $this;
+ array_walk_recursive($messages, function ($item) use (&$messagesToPrint, $escapeHtml, $self) {
+ if (null !== ($translator = $self->getTranslator())) {
+ $item = $translator->translate(
+ $item, $self->getTranslatorTextDomain()
@weierophinney

weierophinney Jul 19, 2013

Owner

One argument per line if you're going to do multiple lines; otherwise, move to the line where the call is made.

@weierophinney weierophinney added a commit that referenced this pull request Jul 19, 2013

@weierophinney weierophinney Merge pull request #4854 from RalfEggert/ralfeggert-1
Allow FormElementErrors view helper to translate messages
dc435b6

@weierophinney weierophinney added a commit that referenced this pull request Jul 19, 2013

@weierophinney weierophinney [#4854] CS and test fixes
- Incorrect assumption in one test led to a failure; fixed.
- Minor CS changes for array notation, method arguments
719d508

@weierophinney weierophinney added a commit that referenced this pull request Jul 19, 2013

@weierophinney weierophinney Merge branch 'hotfix/4854' into develop
Forward port #4854
d9bfca4

@ghost ghost assigned weierophinney Jul 19, 2013

Owner

weierophinney commented Jul 19, 2013

I incorporated feedback on merge.

Thanks, @RalfEggert !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment