From 47f553bc536202209c11c5275805a119a254b768 Mon Sep 17 00:00:00 2001 From: "a.abuzakham" <a.abuzakham@2836067.no-reply.drupal.org> Date: Wed, 18 Oct 2017 16:21:40 +0300 Subject: [PATCH] Issue #2917072 by abu-zakham: Added Media and entity embed templates to fix the generate of weird HTML --- .../entity-embed-container.html.twig | 15 +++++++++++++++ .../templates/media/media--image.html.twig | 19 +++++++++++++++++++ .../video-embed-iframe.html.twig | 7 +++++++ 3 files changed, 41 insertions(+) create mode 100644 themes/vartheme/templates/entity-embed/entity-embed-container.html.twig create mode 100644 themes/vartheme/templates/media/media--image.html.twig create mode 100644 themes/vartheme/templates/video-embed-field/video-embed-iframe.html.twig diff --git a/themes/vartheme/templates/entity-embed/entity-embed-container.html.twig b/themes/vartheme/templates/entity-embed/entity-embed-container.html.twig new file mode 100644 index 00000000..e3af8783 --- /dev/null +++ b/themes/vartheme/templates/entity-embed/entity-embed-container.html.twig @@ -0,0 +1,15 @@ +{# +/** + * @file + * Default theme implementation of a container used to wrap embedded entities. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - children: The rendered child elements of the container. + * + * @see template_preprocess_entity_embed_container() + * + * @ingroup themeable + */ +#} +<div{{ attributes }}>{{ children }}</div> diff --git a/themes/vartheme/templates/media/media--image.html.twig b/themes/vartheme/templates/media/media--image.html.twig new file mode 100644 index 00000000..c6316bb8 --- /dev/null +++ b/themes/vartheme/templates/media/media--image.html.twig @@ -0,0 +1,19 @@ +{# +/** + * @file + * Default theme implementation to present a media entity. + * + * Available variables: + * - name: Name of the media. + * - content: Media content. + * + * @see template_preprocess_media() + * + * @ingroup themeable + */ +#} +<div{{ attributes }}> + {% if content %} + {{ content }} + {% endif %} +</div> diff --git a/themes/vartheme/templates/video-embed-field/video-embed-iframe.html.twig b/themes/vartheme/templates/video-embed-field/video-embed-iframe.html.twig new file mode 100644 index 00000000..b19fa349 --- /dev/null +++ b/themes/vartheme/templates/video-embed-field/video-embed-iframe.html.twig @@ -0,0 +1,7 @@ +{# +/** + * @file + * Display an iframe with alterable components. + */ +#} +<iframe{{ attributes }}{% if url is not empty %} src="{{ url }}{% if query is not empty %}?{{ query | url_encode }}{% endif %}{% if fragment is not empty %}#{{ fragment }}{% endif %}"{% endif %}> </iframe> -- GitLab