forked from GNUsocial/gnu-social
[UI][CONTROLLER] Profile settings action functionality working
This commit is contained in:
parent
91ff4dbdec
commit
2b4540952e
@ -32,6 +32,9 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Core\Controller;
|
||||
// use App\Core\Event;
|
||||
// use App\Util\Common;
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\Form;
|
||||
use function App\Core\I18n\_m;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
@ -52,6 +55,19 @@ class UserAdminPanel extends Controller
|
||||
]);
|
||||
|
||||
$prof->handleRequest($request);
|
||||
if ($prof->isSubmitted()) {
|
||||
$data = $prof->getData();
|
||||
if ($prof->isValid()) {
|
||||
$profile = DB::find('\App\Entity\Profile', ['id' => 2]);
|
||||
foreach (['Nickname', 'FullName', 'Homepage', 'Bio', 'Location'] as $key) {
|
||||
$method = "set{$key}";
|
||||
$profile->{$method}($data[_m($key)]);
|
||||
}
|
||||
DB::flush();
|
||||
} else {
|
||||
// Display error
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'_template' => 'settings/profile.html.twig',
|
||||
|
@ -35,23 +35,6 @@
|
||||
|
||||
{% block body %}
|
||||
<div class='content'>
|
||||
<div id='nickname'>
|
||||
<div class='label'> {{ form_label(prof.Nickname) }} </div> {{ form_widget(prof.Nickname) }}
|
||||
</div>
|
||||
<div id='name'>
|
||||
<div class='label'> {{ form_label(prof.FullName) }} </div> {{ form_widget(prof.FullName) }}
|
||||
</div>
|
||||
<div id='homepage'>
|
||||
<div class='label'> {{ form_label(prof.Homepage) }} </div> {{ form_widget(prof.Homepage) }}
|
||||
</div>
|
||||
<div id='bio'>
|
||||
<div class='label'> {{ form_label(prof.Bio) }} </div> {{ form_widget(prof.Bio) }}
|
||||
</div>
|
||||
<div id='location'>
|
||||
<div class='label'> {{ form_label(prof.Location) }} </div> {{ form_widget(prof.Location) }}
|
||||
</div>
|
||||
<div id='save'>
|
||||
{{ form_widget(prof.save) }}
|
||||
</div>
|
||||
{{ form(prof) }}
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user