I need to tweak the default form template that Translatable uses so that I can insert some custom html, but only under certain circumstances.
Currently, the template is defined in config.yml as such:
a2lix_translation_form:
templating: "A2lixTranslationFormBundle::default.html.twig"
If I change my config to point to my custom template, it works fine:
a2lix_translation_form:
templating: "AcmeBundle:Translatable:template.html.twig"
However, this obviously changes the template globally, whereas I just need it to change for one specific form. How can I tell Translatable to use my custom template on the fly?
Maybe using
{% form_theme form 'AcmeBundle:Translatable:template.html.twig' %}
in the top of your view template works?
From the docs: https://symfony.com/doc/current/form/form_customization.html#method-2-inside-a-separate-template
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.