Skip to content
Snippets Groups Projects
Commit 0381d895 authored by mohamed's avatar mohamed
Browse files

minore

parent 34abac00
Branches
No related tags found
No related merge requests found
...@@ -20,11 +20,11 @@ class ItemType extends AbstractType ...@@ -20,11 +20,11 @@ class ItemType extends AbstractType
->add('price', NumberType::class, ['label' => 'Price']) ->add('price', NumberType::class, ['label' => 'Price'])
->add('description', TextType::class, ['label' => 'Description']) ->add('description', TextType::class, ['label' => 'Description'])
->add('imageFile', VichImageType::class, [ ->add('imageFile', VichImageType::class, [
'label' => 'Upload a new image', // ✅ Change le label pour éviter la confusion 'label' => 'Upload a new image',
'required' => false, // ✅ Permet de ne pas forcer un nouvel upload 'required' => false,
'allow_delete' => false, // ✅ Désactive la suppression automatique 'allow_delete' => false,
'download_uri' => false, // ✅ Désactive le lien de téléchargement 'download_uri' => false,
'image_uri' => false, // ✅ Empêche l'affichage de l'image dans l'input 'image_uri' => false,
]); ]);
} }
...@@ -32,9 +32,9 @@ class ItemType extends AbstractType ...@@ -32,9 +32,9 @@ class ItemType extends AbstractType
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => Item::class, 'data_class' => Item::class,
'csrf_protection' => true, // ✅ Active la protection CSRF 'csrf_protection' => true,
'csrf_field_name' => '_token', // ✅ Définit le nom du champ CSRF 'csrf_field_name' => '_token',
'csrf_token_id' => 'submit', // ✅ Identifie le token 'csrf_token_id' => 'submit',
]); ]);
} }
} }
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
font-size: 1rem; font-size: 1rem;
cursor: pointer; cursor: pointer;
transition: 0.3s; transition: 0.3s;
margin-top: 15px;
} }
.btn:hover { .btn:hover {
background-color: #99CC33; background-color: #99CC33;
...@@ -87,15 +88,19 @@ ...@@ -87,15 +88,19 @@
<div class="container"> <div class="container">
<section class="form-section"> <section class="form-section">
{{ form_start(form, {'attr': {'class': 'input-box'}}) }} {{ form_start(form, {'attr': {'class': 'input-box'}}) }}
{{ form_row(form.title, {'attr': {'class': 'form-control'}}) }}
{{ form_row(form.url, {'attr': {'class': 'form-control'}}) }} {{ form_row(form.title, {'attr': {'class': 'form-control'}}) }}
{{ form_row(form.price, {'attr': {'class': 'form-control'}}) }} {{ form_row(form.url, {'attr': {'class': 'form-control'}}) }}
{{ form_row(form.description, {'attr': {'class': 'form-control'}}) }} {{ form_row(form.price, {'attr': {'class': 'form-control'}}) }}
{{ form_row(form.description, {'attr': {'class': 'form-control'}}) }}
<h3>Item Image</h3>
{{ form_row(form.imageFile, {'attr': {'class': 'form-control'}}) }} <h3 style="margin-top: 20px;">Item Image</h3>
{{ form_row(form.imageFile, {'attr': {'class': 'form-control'}}) }}
<button class="btn">Confirm</button>
{{ form_rest(form) }} {# ✅ Inclut le token CSRF ici #}
<button class="btn" type="submit">Confirm</button>
{{ form_end(form) }} {{ form_end(form) }}
</section> </section>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment