Fix form_enctype deprecation

Use form_start instead
This commit is contained in:
Jeremy Benoist 2015-11-07 00:18:06 +01:00
parent 18f8f32f70
commit 33fe61f92f
3 changed files with 21 additions and 19 deletions

View File

@ -29,7 +29,7 @@ class ConfigController extends Controller
$user = $this->getUser();
// handle basic config detail (this form is defined as a service)
$configForm = $this->createForm('config', $config);
$configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config')));
$configForm->handleRequest($request);
if ($configForm->isValid()) {
@ -49,7 +49,7 @@ class ConfigController extends Controller
}
// handle changing password
$pwdForm = $this->createForm(new ChangePasswordType());
$pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4'));
$pwdForm->handleRequest($request);
if ($pwdForm->isValid()) {
@ -65,7 +65,10 @@ class ConfigController extends Controller
}
// handle changing user information
$userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile')));
$userForm = $this->createForm(new UserInformationType(), $user, array(
'validation_groups' => array('Profile'),
'action' => $this->generateUrl('config').'#set3',
));
$userForm->handleRequest($request);
if ($userForm->isValid()) {
@ -80,7 +83,7 @@ class ConfigController extends Controller
}
// handle rss information
$rssForm = $this->createForm(new RssType(), $config);
$rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2'));
$rssForm->handleRequest($request);
if ($rssForm->isValid()) {
@ -99,7 +102,10 @@ class ConfigController extends Controller
$newUser = $userManager->createUser();
// enable created user by default
$newUser->setEnabled(true);
$newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile')));
$newUserForm = $this->createForm(new NewUserType(), $newUser, array(
'validation_groups' => array('Profile'),
'action' => $this->generateUrl('config').'#set5',
));
$newUserForm->handleRequest($request);
if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {

View File

@ -5,7 +5,7 @@
{% block content %}
<h2>{% trans %}Wallabag configuration{% endtrans %}</h2>
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}>
{{ form_start(form.config) }}
{{ form_errors(form.config) }}
<fieldset class="w500p inline">
@ -37,7 +37,7 @@
<h2>{% trans %}RSS configuration{% endtrans %}</h2>
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.rss) }}>
{{ form_start(form.rss) }}
{{ form_errors(form.rss) }}
<fieldset class="w500p inline">
@ -81,7 +81,7 @@
<h2>{% trans %}User information{% endtrans %}</h2>
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.user) }}>
{{ form_start(form.user) }}
{{ form_errors(form.user) }}
<fieldset class="w500p inline">
@ -115,7 +115,7 @@
<h2>{% trans %}Change your password{% endtrans %}</h2>
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.pwd) }}>
{{ form_start(form.pwd) }}
{{ form_errors(form.pwd) }}
<fieldset class="w500p inline">
@ -148,7 +148,7 @@
{% if is_granted('ROLE_SUPER_ADMIN') %}
<h2>{% trans %}Add a user{% endtrans %}</h2>
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_user) }}>
{{ form_start(form.new_user) }}
{{ form_errors(form.new_user) }}
<fieldset class="w500p inline">

View File

@ -21,9 +21,8 @@
</ul>
</div>
<div id="set1" class="col s12">
<form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}>
{{ form_start(form.config) }}
{{ form_errors(form.config) }}
<div class="row">
@ -57,9 +56,8 @@
</form>
</div>
<div id="set2" class="col s12">
<form action="{{ path('config') }}#set2" method="post" {{ form_enctype(form.rss) }}>
{{ form_start(form.rss) }}
{{ form_errors(form.rss) }}
<div class="row">
@ -111,9 +109,8 @@
</form>
</div>
<div id="set3" class="col s12">
<form action="{{ path('config') }}#set3" method="post" {{ form_enctype(form.user) }}>
{{ form_start(form.user) }}
{{ form_errors(form.user) }}
<div class="row">
@ -150,9 +147,8 @@
</form>
</div>
<div id="set4" class="col s12">
<form action="{{ path('config') }}#set4" method="post" {{ form_enctype(form.pwd) }}>
{{ form_start(form.pwd) }}
{{ form_errors(form.pwd) }}
<div class="row">
@ -189,7 +185,7 @@
{% if is_granted('ROLE_SUPER_ADMIN') %}
<div id="set5" class="col s12">
<form action="{{ path('config') }}#set5" method="post" {{ form_enctype(form.new_user) }}>
{{ form_start(form.new_user) }}
{{ form_errors(form.new_user) }}
<div class="row">