Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

INREL-4995: add output for video and image icons #193

Open
wants to merge 3 commits into
base: 8.x-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions infinite.theme
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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':
Expand All @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions templates/node/node--article--teaser-default-small.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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]) %}
Expand Down
8 changes: 8 additions & 0 deletions templates/node/node--article--teaser-default.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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]) %}
Expand Down