Created
March 14, 2019 23:51
-
-
Save stefbowerman/a526df0573840761a7e19e6960bf41bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign product_tag_string = product.tags | join: ' ' | handle | replace: '-', '' %} | |
{% unless product_tag_string contains 'hide-tagline' %} | |
{% capture display_block_id %} | |
{% include 'product-section-display-block-id', product: product, blocks: section.blocks %} | |
{% endcapture %} | |
{% assign display_block_id = display_block_id | plus: 0 %} | |
{% for block in section.blocks %} | |
{% assign block_id = block.id | plus: 0 %} | |
{% if display_block_id == block_id %} | |
{% include 'tagline', | |
t_title: block.settings.title, | |
t_subtitle: block.settings.subtitle | |
%} | |
{% endif %} | |
{% endfor %} | |
{% endunless %} | |
{% schema %} | |
{ | |
"name": "Product - Tagline", | |
"settings": [ | |
{ | |
"type": "header", | |
"content": "Taglines", | |
"info": "Tagline blocks can be assigned (in decreasing order of specificity) to a product, product tag, or collection. The single, most specific block that applies to the current product will be displayed. If a block isn't assigned to any of these, it will be shown as a fallback when no more specific one applies." | |
} | |
], | |
"blocks": [ | |
{ | |
"type": "tagline", | |
"name": "Tagline", | |
"settings": [ | |
{ | |
"type": "textarea", | |
"id": "title", | |
"label": "Title" | |
}, | |
{ | |
"type": "text", | |
"id": "subtitle", | |
"label": "Subtitle" | |
}, | |
{ | |
"type": "header", | |
"content": "Display" | |
}, | |
{ | |
"type": "product", | |
"id": "product", | |
"label": "Product", | |
"info": "If set, block will only display on this product" | |
}, | |
{ | |
"type": "text", | |
"id": "tag", | |
"label": "Product Tag", | |
"info": "If set, block will only display on products with this tag." | |
}, | |
{ | |
"type": "collection", | |
"id": "collection", | |
"label": "Collection", | |
"info": "If set, block will only display on products in this collection" | |
} | |
] | |
} | |
] | |
} | |
{% endschema %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment