浏览代码

Merge pull request #519 from lucasfilippi/translatable_choice

Add translation support for empty_value in TranslatableChoiceType
Thomas 13 年之前
父节点
当前提交
1b6a423fa2
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      Form/Type/TranslatableChoiceType.php

+ 4 - 0
Form/Type/TranslatableChoiceType.php

@@ -71,5 +71,9 @@ class TranslatableChoiceType extends ChoiceType
         }
 
         $view->set('choices', $choices);
+
+        if ('' !== $view->get('empty_value') && null !== $view->get('empty_value')) {
+            $view->set('empty_value', $this->translator->trans($view->get('empty_value'), array(), $catalogue));
+        }
     }
 }