I am using Drupal 8 and trying to theme video-embed-iframe.html.twig by content type. with the current naming suggestions this is not possible.
I am using Media with video embed field containing in a field called video
This is what I did so far. in the fields template named above in the templates folder of my theme
{% if logged_in %} <iframe{{ attributes }}{% if url is not empty %} src="{{ url }}{% if query is not empty %}?{{ query | url_encode }}{% endif %}"{% endif %}></iframe> {% else %} <div id="promotion"> <div id="promotion-image"> <div id ="promotion-bg"> <div id ="promotion-text"> <H1>Eine brilliante Überschrift</H1> </div> </div> </div> <span id="promotion-attribution"> <a href="http://somesite.com">Credit author of the background image</a></span> </div> {% endif %}
I have no clue how to access the field by content type to separate the code deepening if you have a content type eg page and article Any Ideas?
Is there a way to populate a global var like logged in containing the mashine name of the content type without needing a custom module. I other words is there a way to populate a var like
contenttype=anycotenttypehere in the mytheme.theme file by writing a function? to be able to display the video depending on with contetnt type has been used and if the user is logged in or not