Vincent Decaux Posted December 12, 2024 Share Posted December 12, 2024 I develop a module using Twig for Prestashop 1.7 and 8. I have a form and I would like to use the ImagePreviewType (https://devdocs.prestashop-project.org/8/development/components/form/types-reference/image-preview-type/) But I use this field Type in my module, it just displays a hidden field, not the image preview. I tried to understand, there is a twig file providing the Prestashop UI Kit widget : {% block image_preview_widget %} {# This is the hidden input #} {{- block('form_widget_simple') -}} DEBUG : {{ value }} <img src="{{ value }}" alt="{{ ('Image preview for ' ~ form.vars.name)|trim }}" class="{{ form.vars.image_class }}" /> {% endblock %} But in my module, I don't access this block, I tried to debug. There is an official Prestashop Type which uses this field : PrestaShopBundle\Form\Admin\Sell\Product\HeaderType And from this Form, I access the Prestashop UI Kit block. Do I need something in order to access the UI Kit blocks ? since I use Twig templates in my module, I should just be able to extend the UI Kit no ? Thanks Link to comment Share on other sites More sharing options...
sparkest Posted January 30 Share Posted January 30 To get the ImagePreviewType to display correctly, make sure you extend the correct Twig template for the Prestashop UI Kit in your module. You need to include the necessary assets or override the block to ensure it picks up the UI Kit styling. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now