Skip to content

Commit

Permalink
Updated Draw\Helper\Form, matchTemplate() do not replace label when e…
Browse files Browse the repository at this point in the history
…xists, just translates it
  • Loading branch information
bacinsky committed Sep 4, 2014
1 parent 5be42c4 commit 658a76d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/WebinoDraw/Draw/Helper/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,10 @@ protected function matchTemplate(NodeList $nodes, FormInterface $form)
$elementNodes->each(
'xpath=../span[name(..)="label"]|..//label[@for="' . $elementName . '"]',
function ($nodes) use ($element, $translator) {
$nodes->setValue($translator->translate($element->getLabel()));
$label = $translator->translate($element->getLabel());
foreach ($nodes as $node) {
$node->nodeValue = !$node->isEmpty() ? $translator->translate($node->nodeValue) : $label;
}
}
);

Expand Down

0 comments on commit 658a76d

Please sign in to comment.