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

minore

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