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
{% if article is defined %} | |
<li> | |
{{article.id}} - {{article.title}} | |
</li> | |
{% endif %} |
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
{# v3 #} | |
{# http://craftsnippets.com/articles/universal-language-switcher-for-craft-cms #} | |
{# logic #} | |
{% set currentElement = craft.app.urlManager.matchedElement %} | |
{% set sites = craft.app.sites.getGroupById(currentSite.groupId).getSites() %} | |
{% set switcherLinks = [] %} | |
{% for site in sites|filter(x => x.baseUrl is not empty) %} | |
{% set title = craft.app.i18n.getLocaleById(site.language).displayName %} | |
{% set url = site.getBaseUrl() %} |
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
{# v2 #} | |
{# http://craftsnippets.com/articles/universal-language-switcher-for-craft-cms #} | |
{# logic #} | |
{% set currentElement = craft.app.urlManager.matchedElement %} | |
{% set sites = craft.app.getSites().getGroupById(currentSite.groupId).getSites() %} | |
{% set switcherLinks = [] %} | |
{% for site in sites if site.baseUrl is not empty %} | |
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
{# v5 #} | |
{% if currentUser and currentUser.can('accessCp') and not craft.app.request.isLivePreview %} | |
{% if _globals.get('currentElement') %} | |
{% set element = _globals.get('currentElement') %} | |
{% else %} | |
{% set element = craft.app.urlManager.matchedElement %} | |
{% endif %} | |
{% if element and element.canSave(currentUser) and element.getCpEditUrl() is not null %} | |
{% set editLink = element.getCpEditUrl() %} | |
{% set editText = 'edit'|t %} |
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
{# v4 #} | |
{% if currentUser and currentUser.can('accessCp') and not craft.app.request.isLivePreview %} | |
{% set element = element|default(craft.app.urlManager.matchedElement) %} | |
{% if element and element.isEditable %} | |
{% set editLink = element.getCpEditUrl() %} | |
{% if element.draftId is defined and element.draftId is not null %} | |
{% set editLink = editLink ~ '&draftId='~ element.draftId %} | |
{% endif %} | |
{% set editText = 'edit'|t %} | |
{% else %} |
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
Garnish.on(Craft.BaseElementIndex, 'updateElements', (ev) => { | |
// ev.target = the element index | |
}); |
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
{% extends 'shop/_layouts/main' %} | |
{% block main %} | |
{{ sprig('product_content', {productId: product.id}) }} | |
{{ sprig.script }} | |
{% endblock %} |
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
{% macro prettyUrl(url) %} | |
{{url | |
|trim('https://', 'left') | |
|trim('http://', 'left') | |
|trim('www.', 'left') | |
|trim('/', 'right') | |
}} | |
{% endmacro %} |
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
{# based on Postmark Transactional Email Templates | |
https://postmarkapp.com/transactional-email-templates #} | |
{# If you change button color, remember to pass it to macro AND define "buttonColor" before "extends" tag. #} | |
{# macro title #} | |
{% macro title(titleText) %} | |
{% if titleText is defined %} | |
<h1 style="margin-top: 0; color: #333333; font-size: 22px; font-weight: bold; text-align: center;" align="left">{{titleText}}</h1> | |
{% endif %} |
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
{# v2 #} | |
{%- macro ytAddress(url, lazy = true) -%} | |
{% if url is not empty %} | |
{% set id = url|split('v=')|last %} | |
{% set id = id|split('&')|first %} | |
{% set id = id|split('/')|last %} | |
<div class="youtube-player"> | |
<figure style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; margin: 0px;"> | |
<iframe src="https://www.youtube.com/embed/{{id}}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"{{ lazy ? ' loading="lazy"'}}></iframe> |
NewerOlder