I am rendering a node field (which is an url to an image) in the node template file like bellow
<section class="bg" style="background-image: url({{ file_url(node.field_picture_bg.entity.fileuri) }});">
Works as its supposed to, but i have some logic which tests which exact image field to render and i would like to render the field name from a variable, like so bellow (WHICH DOESNT WORK obviously :) ).
<section class="bg" style="background-image: url({{ file_url(node.MYVARIBLE.entity.fileuri) }});">
Where MYVARIBLE
is the name of the field. Is this even possible in twig?
I know i can archive this with an conditional clause since there are only 2 possibilities for the field name, but this way is more