/**
* @ORM\Entity
* @ORM\Table(name="flux_product")
* @ORM\Entity(repositoryClass="Flux\ProductBundle\Repository\ProductRepository")
* @ORM\HasLifecycleCallbacks
* @Gedmo\TranslationEntity(class="Flux\ProductBundle\Entity\Translation\ProductTranslation")
* @Vich\Uploadable
*/
class Product
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=20, unique=true)
* @Assert\NotBlank()
*/
protected $code;
/**
* @Assert\File(
* maxSize="3M",
* mimeTypes={"image/png", "image/jpeg", "image/pjpeg"}
* )
* @Vich\UploadableField(mapping="vins", fileNameProperty="image1")
*/
protected $image1File;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $image1;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('code', 'text', array('label' => 'Code'))
->add('image1File', 'file', array('label' => 'Image file', 'required' => false))
->add('image1', null, array('label' => 'Image', 'required' => false, 'read_only' => true))
}
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users...@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at http://groups.google.com/group/sonata-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
You are setting this inside the configureListFields functions which you can set an action option, but I need to add the option inside the configureFormFields function.I want that the user can see the thumbnail when he is updating a record (form).
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
return $this->render('FluxPageBundle:Admin:edit.html.twig', array(
'action' => 'edit',
'form' => $view,
'object' => $object,
));
{% for field_name in form_group.fields %}
{% if admin.formfielddescriptions[field_name] is defined %}
{{ form_row(form[field_name])}}
{# CUSTOM IMAGE PREVIEW FIELDS #}
{% if field_name == 'image1' and object.image1 %}
<div class="control-group">
<label class="control-label"></label>
<div class="controls">
<img src="{{ vich_uploader_asset(object, 'image1File') | imagine_filter('imatge50x50') }}" alt="">
</div>
</div>
{% endif %}
{# END CUSTOM IMAGE PREVIEW FIELDS #}
{% endif %}
{% endfor %}
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
--