I would like to create a twig template for the form displayed inside the paragraph widget.
The only way I found is:
function mymodule_field_widget_paragraphs_form_alter(&$element, &$form_state, $context) { // Check that the subform is opened if (count($element['subform']) > 2) { $element['subform']['#theme'][] = 'form__aw_calculator'; } ... }
After that, I have created a twig template form--aw-calculator.html.twig
like the following
<form{{ attributes }}> <div class="grid--all three--columns"> <div class="column column--first bg--red-level-3"> {{ element.field_calc_ts }} {{ element.field_calc_ts_greenlight }} {{ element.field_calc_budget }} ....
Unfortunately, this is half working… some of the fields are displayed some other are not (the form mode used in the paragraph widget setting should display all of them) More over, I can’t see the markup coming from my twig….
I have the feeling that this is not the right way to handle this… any idea ?