parent
b10d389d95
commit
8c89c8c8a1
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Profil;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ProfilType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
->add('description')
|
||||
// ->add('password')
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => Profil::class,
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
{# templates/profil/edit.html.twig #}
|
||||
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit Profile{% endblock %}
|
||||
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('public/css/components/profil.css') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="profile-container">
|
||||
<h1>Edit Profile</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button type="submit" class="btn btn-primary follow-button">Save</button>
|
||||
{{ form_end(form) }}
|
||||
|
||||
<form method="post" action="{{ path('profil_delete', {id: profil.id}) }}" onsubmit="return confirm('Are you sure you want to delete this profile?');">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ profil.id) }}">
|
||||
<button class="btn btn-danger follow-button">Delete Profile</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
<script src="{{ asset('scripts/scripts.js') }}"></script>
|
||||
{% endblock %}
|
Loading…
Reference in new issue