In a custom module, I have created a custom form. In this form, I need to alter the markup of the radio buttons wrapper and add a new attribute. After reading many posts and testing, I can alter all the form elements (form-item, first fieldset...) except this wrapper.
This is the markup I am outputting.
<fieldset ...>
<legend>Mylegend</legend>
<div class="fieldset-wrapper">
<div id="edit-myfield"> <!-- < I need to alter the attributes of this div -->
<div class="form-item js-form-item form-type-radio js-form-type-radio...">
...
</div>
<div class="form-item js-form-item form-type-radio js-form-type-radio...">
...
</div>
</div>
</div>
</fieldset>
I see that the related system template is radios.html.twig. I tried to copy and paste this template in the templates directory of my module without success. I tried to use theme => 'my custom theme'
in the definition of my field. I tried to use a preprocess function in my module.
What is the simpler method to alter this wrapper?