Jump to content

Why the ImagePreviewType is empty when I use it in my module


Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...