diff --git a/infinite.theme b/infinite.theme index 7666d06c..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 @@ -410,6 +412,9 @@ function _infinite_get_icon($node, $variables) { if (!empty($paragraphs = $node->field_paragraphs->referencedEntities())) { foreach ($paragraphs as $paragraph) { switch ($paragraph->bundle()) { + /* + 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': case 'advertising_products_embed': @@ -418,6 +423,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; 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]) %}