我想使用引導樣式應用在fosuserbundle註冊表單中,並且登錄無法覆蓋,但由於註冊表單使用「{{form_widget(form)}}」,所以我不能覆蓋它,我用symfony2.2,我也測試使用形式的主題,這樣如何覆蓋fosuserbundle註冊表格樣式
{% block form_row %}
{% spaceless %}
<div class="control-group">
{{ form_label(form, label|default(null),{ 'attr': {'class': 'control-label'} }) }}
{{ form_errors(form) }}
<div class="controls">{{ form_widget(form) }}</div>
</div>
{% endspaceless %}
{% endblock form_row %}
和
在表單模板 代碼
{% form_theme form with '@user/form/fields.html' %}
{% trans_default_domain 'FOSUserBundle' %}
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register form-horizontal form-box">
{{ form_widget(form) }}
<div>
<input type="submit" value="{{ 'registration.submit'|trans }}" />
</div>
</form>
但它把這個
|form action="/register/" method="POST" class="fos_user_registration_register form-horizontal form-box"|
|div id="fos_user_registration_form"|
|div class="control-group"|
|label for="fos_user_registration_form_username" class="required"|用戶名:|/label|
|div class="controls"|
|input type="text" id="fos_user_registration_form_username" name="fos_user_registration_form[username]" required="required" /|
|/div|
|/div|
|div class="control-group"|
|label for="fos_user_registration_form_email" class="required"|電子郵箱:|/label|
|div class="controls"|
|input type="email" id="fos_user_registration_form_email" name="fos_user_registration_form[email]" required="required" /|
|/div|
|/div|
|div class="control-group"|
|label for="fos_user_registration_form_plainPassword_first" class="required"|密碼:|/label|
|div class="controls"|
|input type="password" id="fos_user_registration_form_plainPassword_first" name="fos_user_registration_form[plainPassword][first]" required="required" /|
|/div|
|/div|
|div class="control-group"|
|label for="fos_user_registration_form_plainPassword_second" class="required"|確認密碼:|/label|
|div class="controls"|
|input type="password" id="fos_user_registration_form_plainPassword_second" name="fos_user_registration_form[plainPassword][second]" required="required" /|
|/div|
|/div|
|input type="hidden" id="fos_user_registration_form__token" name="fos_user_registration_form[_token]" value="622a4c73bfc48b4944c5b97ff4fc46c7fa8e9e91" /|
|/div|
|div|
|input type="submit" value="註冊" /|
|/div|
|/form|
它不是我想要的,所以我能爲它做什麼?thx!