How can I pass a variable from my custom module to a twig field template?
my field template is the "field--node--field-webform--parliament-visit.html.twig"
and my module is named as "custommodule"
I tried this function according to documentation but apparently I didnt understand smth correctly:
function custommodule_preprocess_field_node_field_webform_parliament_visit(array &$variables) {
$VARIABLE_NAME = 'my_variable';
$variables['varname'] = $VARIABLE_NAME ;
}
custommodule_preprocess_field_node_field_webform_parliament_visit
changelogintosubmit
by your module namecustommodule
and don't forget to flush all cache.custommodule_preprocess_field__node__field_webform__parliament_visit
.