I have tried several solutions to get my node--view--viewname.html.twig to print out an iframe, but no success so far.
I have in my theme_preprocess_node function the following:
$vars['vimeo_embed'] = array(
'#markup' => \Drupal\Core\Render\Markup::create($vimeo_embed),
'#allowed_tags' => ['iframe','a','html'],
);
following the advice of this thread: http://drupal.stackexchange.com/questions/184963/pass-raw-html-to-markup
and in my node--view--viewname.html.twig all the following does not work:
<iframe src="{{ node.field_vimeo_embed_url[0]['value'] }}"></iframe>
{{ node.field_vimeo_embed_url[0].getValue()['value'] }}
{{ vimeo_embed['#markup']| raw }}
{{ vimeo_embed['#markup'] }}
{% verbatim %}
{{ vimeo_embed['#markup']| raw }}
{{ '<iframe></iframe>' | raw('html') }}
<iframe></iframe>
{% endverbatim %}
I have tried changing the output of mytheme_preprocess_views_view_field(&$variables) because I thought the problem was to be found in the advancedRender function, but to no avail.
Any help with this is greatly appreciated.
Comments
Comment #2
h_dries commentedThe problem turned out to be caused in my own controller, added #markup and #allowed_tags here and now it works.
Comment #3
h_dries commented