Skip to content

Instantly share code, notes, and snippets.

@mariohernandez
Created November 18, 2016 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariohernandez/316883047fbf0983d3383b6b3a115f78 to your computer and use it in GitHub Desktop.
Save mariohernandez/316883047fbf0983d3383b6b3a115f78 to your computer and use it in GitHub Desktop.
{# set a variable for social media icons
to later pass to the component template #}
{%
set social = [
{
url: content.field_card_social_link.0['#url'].uri,
icon: content.field_card_social_link.0['#title'],
},
{
url: content.field_card_social_link.1['#url'].uri,
icon: content.field_card_social_link.1['#title'],
},
{
url: content.field_card_social_link.2['#url'].uri,
icon: content.field_card_social_link.2['#title'],
},
]
%}
{# include card component template #}
{%
include '@demo/card/card.twig' with {
image: content.field_card_photo,
name: content.field_card_name,
bio: content.field_card_biography,
socialLinks: social,
} only
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment