From ac6750fe2839a102a88ac2dea48149562bbba861 Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter Date: Mon, 5 Nov 2018 17:10:18 +0100 Subject: [PATCH 1/3] INREL-4995: add output for video and image icons --- .../node/node--article--teaser-default-small.html.twig | 8 ++++++++ templates/node/node--article--teaser-default.html.twig | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/templates/node/node--article--teaser-default-small.html.twig b/templates/node/node--article--teaser-default-small.html.twig index 44a5c340..3824167f 100644 --- a/templates/node/node--article--teaser-default-small.html.twig +++ b/templates/node/node--article--teaser-default-small.html.twig @@ -2,6 +2,14 @@ 'teaser', 'teaser--small', 'contextual-region' ] %} +{% if (teaser_icon) and (teaser_icon == 'video') %} + {% set smart_teaser_class = 'teaser-smart-video' %} + {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} +{% endif %} +{% if (teaser_icon) and (teaser_icon == 'image') %} + {% set smart_teaser_class = 'teaser-smart-image' %} + {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} +{% endif %} {% if content.field_smart_teaser_class is defined and content.field_smart_teaser_class is not empty %} {% set smart_teaser_class = content.field_smart_teaser_class|render %} {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} diff --git a/templates/node/node--article--teaser-default.html.twig b/templates/node/node--article--teaser-default.html.twig index e2ed95b7..667e71ae 100644 --- a/templates/node/node--article--teaser-default.html.twig +++ b/templates/node/node--article--teaser-default.html.twig @@ -4,6 +4,14 @@ 'contextual-region', ] %} +{% if (teaser_icon) and (teaser_icon == 'video') %} + {% set smart_teaser_class = 'teaser-smart-video' %} + {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} +{% endif %} +{% if (teaser_icon) and (teaser_icon == 'image') %} + {% set smart_teaser_class = 'teaser-smart-image' %} + {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} +{% endif %} {% if content.field_smart_teaser_class is defined and content.field_smart_teaser_class is not empty %} {% set smart_teaser_class = content.field_smart_teaser_class|render %} {% set wrapper_classes = wrapper_classes|merge([smart_teaser_class]) %} From b7a7e51b9e122c881f3b8acb5ad6562737ea763d Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter Date: Tue, 6 Nov 2018 10:05:42 +0100 Subject: [PATCH 2/3] INREL-4995: remove shop-it logic here, it is in instyle_infinite now --- infinite.theme | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/infinite.theme b/infinite.theme index 7666d06c..cb82de69 100644 --- a/infinite.theme +++ b/infinite.theme @@ -410,6 +410,9 @@ function _infinite_get_icon($node, $variables) { if (!empty($paragraphs = $node->field_paragraphs->referencedEntities())) { foreach ($paragraphs as $paragraph) { switch ($paragraph->bundle()) { + /* + This was moved to instyle_infinite.theme as the other sites do not have the shop-it badge and it overwrites the other ones. + case 'productdb_product': case 'advertising_products_paragraph': case 'advertising_products_embed': @@ -418,6 +421,7 @@ function _infinite_get_icon($node, $variables) { // shopping overrides everything else $variables['teaser_icon'] = 'shop-it'; break 2; + */ case 'gallery': $variables['teaser_icon']['image'] = 'image'; break; From 39377cbe868785a5b8d1a88000be09810f397822 Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter Date: Wed, 7 Nov 2018 13:58:14 +0100 Subject: [PATCH 3/3] INREL-4995: add TODOs --- infinite.theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/infinite.theme b/infinite.theme index cb82de69..ccd61ba2 100644 --- a/infinite.theme +++ b/infinite.theme @@ -401,6 +401,8 @@ function infinite_inject_pinterest_image($variables, $entity) /** * Check which icon to display. * + * TODO: Replace render-time logic with a field to store the info in. + * * @param $node * @param $variables * @return mixed @@ -411,7 +413,7 @@ function _infinite_get_icon($node, $variables) { foreach ($paragraphs as $paragraph) { switch ($paragraph->bundle()) { /* - This was moved to instyle_infinite.theme as the other sites do not have the shop-it badge and it overwrites the other ones. + TODO: This was moved to instyle_infinite.theme as the other sites do not have the shop-it badge and it overwrites the other ones. Once the other sites have those badges too, this needs to be re-enabled. case 'productdb_product': case 'advertising_products_paragraph':