KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am using FOSUserBundle for managing my users. In order to register user, I reused the form of the bundle which meets my needs. Nevertheless, I needed to set some attributes of my fields. This is was done easyly by twig like this: {{ form_widget(form.username, { 'attr': {'class': "span12", 'placeholder': "Username"} }) }} Now, my goal is to make automatic translation on my placeholder, so I proposed this code: {{ form_widget(form.username, { 'attr': {'class': "span12", 'placeholder': "{{'security.login.usernameplaceholder'|trans}}"} }) }} This previous code produced an input with placeholder value equal to {{'security.login.usernameplaceholder'|trans}} To get rid of this problem, I tried to set variable for that but symfony generated an error!!! {% set usernameplaceholder = {{'security.login.usernameplaceholder'|trans}} %} {{ form_widget(form.username, { 'attr': {'class': "span12", 'placeholder': usernameplaceholder} }) }} Is there any proposition to solve this problem? Thanks,
Tags (comma-separated)
Save Edits
Cancel