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
{# 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
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
{# v6 #} | |
{# USAGE: | |
{% embed '_components/modal' with { | |
modalHandle: 'exampleHandle' | |
} %} | |
{% block modalContent %} | |
SOMETHING INSIDE | |
{% endblock %} | |
{% endembed %} | |
#} |
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
[data-neo-b].blocktype{ | |
font-size: 1.1rem; | |
background-color: #03A9F4; | |
color: white; | |
padding-left: 3rem !important; | |
padding-right: 3rem !important; | |
} | |
.ni_block{ | |
border: 2px solid rgb(3 169 244 / 50%) !important; |
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
{{ craft.navigation.nodes().ancestorOf( craft.navigation.nodes('test').all()|filter(x => x.element.id == id)|first.id ).ancestorDist(1).one().element.uri ?? null }}/{{slug}} |
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 linkList(entries) -%} | |
{{entries | |
|map(singleElement => "<a href='#{singleElement.url}'>#{singleElement.title}</a>") | |
|join(', ') | |
|raw}} | |
{%- endmacro -%} |
NewerOlder