Last active
October 20, 2020 16:27
-
-
Save isaactopo/e6a4af1ffb6e8de0cadb7948e2f15c8a to your computer and use it in GitHub Desktop.
VSCode PHP & Kirby Snippets
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
{ | |
"K:Snippet": { | |
"scope": "php,html", | |
"prefix": "sn", | |
"body": [ | |
"<?php snippet('${1|header,footer,cta|}') ?>" | |
], | |
"description": "Create Kirby Snippet" | |
}, | |
"Open PHP": { | |
"scope": "php,html", | |
"prefix": "php", | |
"body": [ | |
"<?php $1 ${2:?>}" | |
], | |
"description": "Create PHP Open Tag" | |
}, | |
"Foreach Shorthand": { | |
"scope": "php,html", | |
"prefix": "foreach", | |
"body": [ | |
"<?php foreach (${1:$} as ${2:$}):?>", | |
"${CLIPBOARD}", | |
"<?php endforeach ?>" | |
], | |
"description": "PHP Foreach" | |
}, | |
"Unsplash image URL": { | |
"scope": "php,html", | |
"prefix": "unsp", | |
"body": [ | |
"https://source.unsplash.com/${1:1500}x${2:1200}/?${3|nature,water,office,work|}" | |
], | |
"description": "Unsplash image URL" | |
}, | |
"Unsplash image specific URL": { | |
"scope": "php,html", | |
"prefix": "uurl", | |
"body": [ | |
"https://source.unsplash.com/${1:ID}/${2:1500}x${3:1200}" | |
], | |
"description": "Unsplash image URL" | |
}, | |
"PHP:Echo Shorthand": { | |
"scope": "php,html", | |
"prefix": "ec", | |
"body": [ | |
"<?= $1 ?>" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"PHP:Echo Shorthand with $page": { | |
"scope": "php,html", | |
"prefix": [ | |
"ep", | |
"kf" | |
], | |
"body": [ | |
"<?= ${1:$$page}->${2:$CLIPBOARD}()$3 ?>" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"PHP:Echo Shorthand for $page — KT Inline": { | |
"scope": "php,html", | |
"prefix": "kti", | |
"body": [ | |
"<?= ${1:$$page}->${2:$CLIPBOARD}()->kti()$3 ?>" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"PHP:Echo Shorthand for $page — KT": { | |
"scope": "php,html", | |
"prefix": "kt", | |
"body": [ | |
"<?= ${1:$$page}->${2:$CLIPBOARD}()->kt()$3 ?>" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"Kirby: Site URL": { | |
"scope": "php,html", | |
"prefix": "su", | |
"body": [ | |
"<?= $$site->url() ?>$1" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"Kirby: Kirby Assets": { | |
"scope": "php,html", | |
"prefix": "ka", | |
"body": [ | |
"<?= kirby()->urls()->assets() ?>$1" | |
], | |
"description": "PHP:Echo Shorthand" | |
}, | |
"Kirby: Kirby Image": { | |
"scope": "php,html", | |
"prefix": "ki", | |
"body": [ | |
"<?php if($$img=${1:$$page}->${2:$CLIPBOARD}()->toFile()): ?>", | |
"<img src=\"<?= $$img->resize(${3:1500}, null, ${4:85})->url() ?>\" srcset=\"<?= $$img->srcset() ?>\" sizes=\"100vw\" alt=\"<?= $$img->alt() ?>\" class=\"${5:bg-image}\" loading=\"lazy\">", | |
"<?php endif ?>" | |
], | |
"description": "PHP:Echo image with conditional" | |
}, | |
"Kirby: translate": { | |
"scope": "php,html", | |
"prefix": "tr", | |
"body": [ | |
"<?= t('$1'${2:,'$3'}) ?>" | |
], | |
"description": "PHP: Kirby translate" | |
}, | |
"Kirby: blueprint add Select": { | |
"scope": "yml,yaml", | |
"prefix": "bs", | |
"body": [ | |
"${1:$category}:", | |
" label: ${2:$Categoría}", | |
" width: ${3|1,1/2,2/3,1/3|}", | |
" type: select", | |
" options:", | |
" ${4:$key}: ${5:$panel text}" | |
], | |
"description": "YAML: Kirby add select to blueprint" | |
}, | |
"Kirby: blueprint add text": { | |
"scope": "yml,yaml", | |
"prefix": "bt", | |
"body": [ | |
"${1:$textField}:", | |
" label: ${2:$Texto}", | |
" width: ${3|1,1/2,2/3,1/3|}", | |
" type: ${4|text,textarea,editor,url|}" | |
], | |
"description": "YAML: Kirby add text field to blueprint" | |
}, | |
"Kirby: URL": { | |
"scope": "php,html", | |
"prefix": "ku", | |
"body": [ | |
"<?= u('${1:page}') ?>" | |
], | |
"description": "K:Echoes given page URL" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment