├── .vscodeignore ├── .gitignore ├── images ├── icon.png ├── icon.sketch ├── icon@2x.png └── icon.svg ├── etc └── twig-for-craft-2.html ├── package.json ├── README.md └── snippets └── snippets.json /.vscodeignore: -------------------------------------------------------------------------------- 1 | /etc -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .tmp 2 | .temp 3 | .vscode 4 | .DS_Store -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selvinortiz/vs-code-twig-for-craft-2/HEAD/images/icon.png -------------------------------------------------------------------------------- /images/icon.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selvinortiz/vs-code-twig-for-craft-2/HEAD/images/icon.sketch -------------------------------------------------------------------------------- /images/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/selvinortiz/vs-code-twig-for-craft-2/HEAD/images/icon@2x.png -------------------------------------------------------------------------------- /etc/twig-for-craft-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Twig for Craft 2 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "twig-for-craft-2", 3 | "displayName": "Twig for Craft 2", 4 | "description": "Adds a comprehensive set of Craft 2 snippets to use in your Twig templates.", 5 | "version": "0.5.0", 6 | "publisher": "selvinortiz", 7 | "author": { 8 | "name": "Selvin Ortiz", 9 | "email": "selvin@selvin.co", 10 | "url": "https://selvinortiz.com" 11 | }, 12 | "homepage": "https://github.com/selvinortiz/twig-for-craft-2", 13 | "bugs": { 14 | "url": "https://github.com/selvinortiz/twig-for-craft-2/issues" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/selvinortiz/twig-for-craft-2.git" 19 | }, 20 | "icon": "images/icon.png", 21 | "galleryBanner": { 22 | "color": "#da513d", 23 | "theme": "dark" 24 | }, 25 | "keywords": [ 26 | "twig", 27 | "craft", 28 | "craftcms", 29 | "snippets", 30 | "snippet", 31 | "vscode" 32 | ], 33 | "engines": { 34 | "vscode": "^1.5.0" 35 | }, 36 | "categories": [ 37 | "Snippets" 38 | ], 39 | "contributes": { 40 | "snippets": [ 41 | { 42 | "language": "twig", 43 | "path": "./snippets/snippets.json" 44 | } 45 | ] 46 | } 47 | } -------------------------------------------------------------------------------- /images/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | icon 5 | Created with Sketch. 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Twig for Craft 2 2 | > Adds a comprehensive set of Craft 2 snippets to use in your Twig templates. 3 | 4 | ## Tab Trigger Reference 5 | 6 | ### Generic Triggers 7 | 8 | ```twig 9 | 10 | }} {{ }} 11 | %% {% %} 12 | ## {# #} 13 | 14 | do {% do ... %} 15 | extends {% extends 'template' %} 16 | from {% from 'template' import 'macro' %} 17 | import {% import 'template' as name %} 18 | importself {% import _self as name %} 19 | inc, include {% include 'template' %} 20 | incp {% include 'template' with params %} 21 | inckv {% include 'template' with { key: value } %} 22 | use {% use 'template' %} 23 | 24 | autoescape {% autoescape 'type' %}...{% endautoescape %} 25 | block, blockb {% block name %} ... {% endblock %} 26 | blockf {{ block('...') }} 27 | embed {% embed "template" %}...{% endembed %} 28 | filter, filterb {% filter name %} ... {% endfilter %} 29 | macro {% macro name(params) %}...{% endmacro %} 30 | set, setb {% set var = value %} 31 | spaceless {% spaceless %}...{% endspaceless %} 32 | verbatim {% verbatim %}...{% endverbatim %} 33 | 34 | if, ifb {% if condition %} ... {% endif %} 35 | ife {% if condition %} ... {% else %} ... {% endif %} 36 | for {% for item in seq %} ... {% endfor %} 37 | fore {% for item in seq %} ... {% else %} ... {% endfor %} 38 | 39 | else {% else %} 40 | endif {% endif %} 41 | endfor {% endfor %} 42 | endset {% endset %} 43 | endblock {% endblock %} 44 | endfilter {% endfilter %} 45 | endautoescape {% endautoescape %} 46 | endembed {% endembed %} 47 | endfilter {% endfilter %} 48 | endmacro {% endmacro %} 49 | endspaceless {% endspaceless %} 50 | endverbatim {% endverbatim %} 51 | ``` 52 | 53 | ### Craft Triggers 54 | 55 | ```twig 56 | asset craft.assets.first() 57 | assets, assetso craft.assets loop 58 | categories, categorieso craft.categories loop 59 | entries, entrieso craft.entries loop 60 | feed craft.feeds.getFeedItems loop 61 | t |t 62 | replace |replace('search', 'replace') 63 | replacex |replace('/(search)/i', 'replace') 64 | split |split('\n') 65 | tags, tagso craft.tags loop 66 | users, userso craft.users loop 67 | 68 | cache {% cache %}...{% endcache %} 69 | children {% children %} 70 | exit {% exit 404 %} 71 | ifchildren {% ifchildren %}...{% endifchildren %} 72 | includecss {% includecss %}...{% endincludecss %} 73 | includecssfile {% includeCssFile "/resources/css/global.css" %} 74 | includehirescss {% includehirescss %}...{% endincludehirescss %} 75 | includejs {% includejs %}...{% endincludejs %} 76 | includejsfile {% includeJsFile "/resources/js/global.js" %} 77 | matrix, matrixif Basic Matrix field loop using if statements 78 | matrixifelse Basic Matrix field loop using if/elseif 79 | matrixswitch Basic Matrix field loop using switch 80 | nav {% nav item in items %}...{% endnav %} 81 | paginate Outputs example of pagination and prev/next links 82 | redirect {% redirect 'login' %} 83 | requirelogin {% requireLogin %} 84 | requirepermission {% requirePermission "spendTheNight" %} 85 | switch {% switch variable %}...{% endswitch %} 86 | 87 | csrf {{ getCsrfInput() }} 88 | getfoothtml {{ getFootHtml() }} 89 | getheadhtml {{ getHeadHtml() }} 90 | 91 | getparam craft.request.getParam() 92 | getpost craft.request.getPost() 93 | getquery craft.request.getQuery() 94 | getsegment craft.request.getSegment() 95 | 96 | case {% case "value" %} 97 | endcache {% endcache %} 98 | endifchildren {% endifchildren %} 99 | endincludecss {% endincludecss %} 100 | endincludehirescss {% endincludehirescss %} 101 | endincludejs {% endincludejs %} 102 | endnav {% endnav %} 103 | 104 | ceil ceil() 105 | floor floor() 106 | max max() 107 | min min() 108 | round round() 109 | shuffle shuffle() 110 | random random() 111 | url, urla url('path'), url('path', params, 'http', false) 112 | 113 | rss Example rss feed 114 | 115 | dd
{{ dump() }}
{% exit %} 116 | dump
{{ dump() }}
117 | ``` 118 | 119 | ### Example Forms 120 | ``` 121 | formlogin Example login form 122 | formuserprofile Example user profile form 123 | formuserregistration Example user registration form 124 | formforgotpassword Example forgot password form 125 | formsetpassword Example set password form 126 | formsearch Example search form 127 | formsearchresults Example search form results 128 | ``` 129 | 130 | ### Reference Hints 131 | ``` 132 | info All craft.assets properties and template tags 133 | info All craft.crategories properties and template tags 134 | info All craft.config properties and template tags 135 | info All craft.entries properties and template tags 136 | info All craft.feeds properties and template tags 137 | info All craft.fields properties and template tags 138 | info All craft.globals properties and template tags 139 | info All craft.request properties and template tags 140 | info All craft.sections properties and template tags 141 | info All craft.session properties and template tags 142 | info All craft.tags properties and template tags 143 | info All craft.users properties and template tags 144 | info All craft globals (site info, date, users, template tags) 145 | ``` 146 | 147 | ## Credits 148 | This extension is _heavily_ influenced by the amazing work of [Ben Parizek] on [Craft Twig for Sublime/Textmate][craft-twig] 149 | 150 | Thank you, Ben👍 151 | 152 | ## Changelog 153 | 154 | ### 0.5.0 155 | - Added `random`, `replace`, `replacex`, and `split` 156 | - Added a bunch of useful _example form_ based on the Craft docs 157 | 158 | Big thanks to [Dominic](https://github.com/DominicVonk) 👍 159 | 160 | ### 0.4.0 161 | - Fixed wrong path used in `includejs` 162 | - Renamed `ciel` to `ceil` where necessary 163 | 164 | Thank you, [Dominic](https://github.com/DominicVonk) 👍 165 | 166 | ### 0.3.0 167 | - Added full tab trigger reference table 168 | - Added `t` tab trigger for static translations 169 | - Added `dd` tab trigger for the twig context 170 | - Updated _snippets file_ to use spaces instead of tabs 171 | - Removed `dd` tab trigger for _non-template_ contexts 172 | 173 | ### 0.2.0 174 | - Added branding resources 175 | - Added extension and repository metadata 176 | - Fixed issue where snippets were not triggering suggestions 177 | 178 | ### 0.1.0 179 | - Initial (alpha) release 180 | 181 | [Ben Parizek]:https://github.com/BenParizek 182 | [craft-twig]:https://github.com/barrelstrength/Craft-Twig.tmbundle 183 | -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "asset": { 3 | "prefix": "asset", 4 | "body": "{% set asset = ${1:entry.assetFieldHandle}.first() %}\n\n{% if asset %}\n\t\"{{\n{% endif %}", 5 | "description": "asset", 6 | "scope": "text.html.twig" 7 | }, 8 | "assets": { 9 | "prefix": "assets", 10 | "body": "{% for image in craft.assets.\n\t.sourceId('${1:1}')\n\t.kind('${2:image}')\n\t.limit(${3:10})\n}) %}\n\t\"{{\n{% endfor %}\n$0", 11 | "description": "craft.assets", 12 | "scope": "text.html.twig" 13 | }, 14 | "autoescape": { 15 | "prefix": "autoescape", 16 | "body": "{% autoescape '${1:type}' %}\n\t$0\n{% endautoescape %}", 17 | "description": "autoescape", 18 | "scope": "text.html.twig" 19 | }, 20 | "blockb": { 21 | "prefix": "blockb", 22 | "body": "{% block ${1:name} %}\n\t$0\n{% endblock %}", 23 | "description": "block (block)", 24 | "scope": "text.html.twig" 25 | }, 26 | "block": { 27 | "prefix": "block", 28 | "body": "{% block ${1:name} %}$0{% endblock %}", 29 | "description": "block", 30 | "scope": "text.html.twig" 31 | }, 32 | "blockf": { 33 | "prefix": "blockf", 34 | "body": "{{ block('${1:name}') }}$0", 35 | "description": "blockf", 36 | "scope": "text.html.twig" 37 | }, 38 | "cache": { 39 | "prefix": "cache", 40 | "body": "{% cache %}\n\t$1\n{% endcache %}\n$0", 41 | "description": "cache", 42 | "scope": "text.html.twig" 43 | }, 44 | "case": { 45 | "prefix": "case", 46 | "body": "{% case \"${1:value}\" %}\n\t$0", 47 | "description": "case", 48 | "scope": "text.html.twig" 49 | }, 50 | "children": { 51 | "prefix": "children", 52 | "body": "{% children %}$0", 53 | "description": "children", 54 | "scope": "text.html.twig" 55 | }, 56 | "ceil": { 57 | "prefix": "ceil", 58 | "body": "ceil($1)$0", 59 | "description": "ceil", 60 | "scope": "text.html.twig" 61 | }, 62 | "formlogin": { 63 | "prefix": "formlogin", 64 | "body": "
\n\t{{ getCsrfInput() }}\n\t\n\n\t

\n\t\n\n\t

\n\t\n\n\t\n\n\t\n\n\t{% if errorMessage is defined %}\n\t\t

{{ errorMessage }}

\n\t{% endif %}\n
\n\n

Forget your password?

", 65 | "description": "craft.user - example login form", 66 | "scope": "text.html.twig" 67 | }, 68 | "formuserprofile": { 69 | "prefix": "formuserprofile", 70 | "body": "
\n\t{{ getCsrfInput() }}\n\t\n\t\n\t\n\n\t\n\t\n\n\t\n\t\n\n\t\n
", 71 | "description": "craft.user - example user profile form", 72 | "scope": "text.html.twig" 73 | }, 74 | 75 | "formuserregistration": { 76 | "prefix": "formuserregistration", 77 | "body": "
\n\t{{ getCsrfInput() }}\n\t\n\t\n\n\t{% macro errorList(errors) %}\n\t\t{% if errors %}\n\t\t\t\n\t\t{% endif %}\n\t{% endmacro %}\n\n\t{% from _self import errorList %}\n\n\t

\n\t\n\n\t{% if account is defined %}\n\t\t{{ errorList(account.getErrors('username')) }}\n\t{% endif %}\n\n\t

\n\t\n\n\t{% if account is defined %}\n\t\t{{ errorList(account.getErrors('email')) }}\n\t{% endif %}\n\n\t

\n\t\n\n\t{% if account is defined %}\n\t\t{{ errorList(account.getErrors('password')) }}\n\t{% endif %}\n\n\t\n
", 78 | "description": "craft.user - example user registration form", 79 | "scope": "text.html.twig" 80 | }, 81 | "formforgotpassword": { 82 | "prefix": "formforgotpassword", 83 | "body": "
\n\t{{ getCsrfInput() }}\n\t\n\t\n\n\t

\n\t\n\n\t{% if errors is defined %}\n\t\t\n\t{% endif %}\n\n\t\n
", 84 | "description": "craft.user - example forgot password form", 85 | "scope": "text.html.twig" 86 | }, 87 | "formsetpassword": { 88 | "prefix": "formsetpassword", 89 | "body": "
\n\t{{ getCsrfInput() }}\n\t\n\t\n\t\n\n\t

\n\t\n\t{% if errors is defined %}\n\t\t\n\t{% endif %}\n\n\t\n
", 90 | "description": "craft.user - example set password form", 91 | "scope": "text.html.twig" 92 | }, 93 | "formsearch": { 94 | "prefix": "formsearch", 95 | "body": "
\n\t\n\t\n
", 96 | "description": "craft.entries - example search form", 97 | "scope": "text.html.twig" 98 | }, 99 | "formsearchresults": { 100 | "prefix": "formsearchresults", 101 | "body": "

Search Results

\n\n{% set query = craft.request.getParam('q') %}\n{% set entries = craft.entries.search(query).order('score') %}\n\n{% if entries|length %}\n\t

{{ entries|length }} results:

\n\n\t\n{% else %}\n\t

Your search for “{{ query }}” didn’t return any results.

\n{% endif %}", 102 | "description": "craft.entries - example search results", 103 | "scope": "text.html.twig" 104 | }, 105 | "rss": { 106 | "prefix": "rss", 107 | "body": "\n\n\t\n\t\t{{ siteName }}\n\t\t{{ siteUrl }}\n\t\t\n\t\t{{ globals.siteDescription }}\n\t\ten-us\n\t\t{{ now.rss }}\n\t\t{{ now.rss }}\n\n\t\t{% for entry in craft.entries.find() %}\n\t\t\t\n\t\t\t\t{{ entry.title }}\n\t\t\t\t{{ entry.url }}\n\t\t\t\t{{ entry.postDate.rss }}\n\t\t\t\t{{ entry.author }}\n\t\t\t\t{{ entry.url }}\n\t\t\t\t\n\t\t\t\n\t\t{% endfor %}\n\t\n", 108 | "description": "craft.entries - example rss feed", 109 | "scope": "text.html.twig" 110 | }, 111 | "assetso": { 112 | "prefix": "assetso", 113 | "body": "{% set assets = craft.assets({\n\tsourceId: '${1:1}',\n\tkind: '${2:image}',\n\tlimit: ${3:10}\n}) %}\n\n{% for image in assets %}\n\t\"{{\n{% endfor %}\n$0", 114 | "description": "craft.assets - object syntax", 115 | "scope": "text.html.twig" 116 | }, 117 | "categorieso": { 118 | "prefix": "categorieso", 119 | "body": "{% set categories = craft.categories({\n\tgroup: '${1:categoryGroupHandle}',\n\tlimit: '${2:11}'\n}) %}\n\n", 120 | "description": "craft.categories - object syntax", 121 | "scope": "text.html.twig" 122 | }, 123 | "categories": { 124 | "prefix": "categories", 125 | "body": "", 126 | "description": "craft.categories", 127 | "scope": "text.html.twig" 128 | }, 129 | "info": { 130 | "prefix": "info", 131 | "body": "{# Access any settings in craft/config/general.php #}\n{% if craft.config.devMode %}{% endif %}\n\n{# Access settings in any config file #}\n{{ craft.config.get('someConfigSetting', 'someConfigFile') }}\n\n{# General Settings #}\n{{ craft.config.appId }}\n{{ craft.config.cacheDuration }}\n{{ craft.config.cacheMethod }}\n{{ craft.config.customAsciiCharMappings }} {# array #}\n{{ craft.config.defaultCookieDomain }}\n{{ craft.config.devMode }}\n{{ craft.config.environmentVariables }} {# array #}\n{{ craft.config.isSystemOn }}\n{{ craft.config.logDumpMethod }}\n{{ craft.config.overridePhpSessionLocation }}\n{{ craft.config.phpMaxMemoryLimit }}\n{{ craft.config.runTasksAutomatically }}\n{{ craft.config.searchIgnoreWords }} {# array #}\n{{ craft.config.siteName }} {# can be an array #}\n{{ craft.config.siteUrl }} {# can be an array #}\n{{ craft.config.timezone }}\n{{ craft.config.translationDebugOutput }}\n{{ craft.config.useCompressedJs }}\n{{ craft.config.useWriteFileLock }}\n{{ craft.config.useXSendFile }}\n\n{# Security Settings #}\n{{ craft.config.csrfTokenName }}\n{{ craft.config.defaultFilePermissions }}\n{{ craft.config.defaultFolderPermissions }}\n{{ craft.config.defaultTokenDuration }}\n{{ craft.config.enableCsrfProtection }}\n{{ craft.config.tokenParam }}\n{{ craft.config.useSecureCookies }}\n\n{# Updates Settings #}\n{{ craft.config.allowAutoUpdates }}\n{{ craft.config.backupDbOnUpdate }}\n{{ craft.config.restoreDbOnUpdateFailure }}\n\n{# URL Settings #}\n{{ craft.config.actionTrigger }}\n{{ craft.config.addTrailingSlashesToUrls }}\n{{ craft.config.allowUppercaseInSlug }}\n{{ craft.config.baseCpUrl }}\n{{ craft.config.cpTrigger }}\n{{ craft.config.limitAutoSlugsToAscii }}\n{{ craft.config.maxSlugIncrement }}\n{{ craft.config.omitScriptNameInUrls }}\n{{ craft.config.pageTrigger }}\n{{ craft.config.resourceTrigger }}\n{{ craft.config.slugWordSeparator }}\n{{ craft.config.usePathInfo }}\n\n{# Templating Settings #}\n{{ craft.config.cacheElementQueries }}\n{{ craft.config.defaultTemplateExtensions }} {# array #}\n{{ craft.config.errorTemplatePrefix }}\n{{ craft.config.indexTemplateFilenames }}\n{{ craft.config.privateTemplateTrigger }}\n\n{# Users Settings #}\n{{ craft.config.activateAccountFailurePath }}\n{{ craft.config.activateAccountSuccessPath }}\n{{ craft.config.autoLoginAfterAccountActivation }}\n{{ craft.config.blowfishHashCost }}\n{{ craft.config.cooldownDuration }}\n{{ craft.config.invalidLoginWindowDuration }}\n{{ craft.config.invalidUserTokenPath }}\n{{ craft.config.loginPath }}\n{{ craft.config.logoutPath }}\n{{ craft.config.maxInvalidLogins }}\n{{ craft.config.postCpLoginRedirect }}\n{{ craft.config.postLoginRedirect }}\n{{ craft.config.purgePendingUsersDuration }}\n{{ craft.config.rememberUsernameDuration }}\n{{ craft.config.rememberedUserSessionDuration }}\n{{ craft.config.requireMatchingUserAgentForSession }}\n{{ craft.config.requireUserAgentAndIpForSession }}\n{{ craft.config.setPasswordPath }}\n{{ craft.config.setPasswordSuccessPath }}\n{{ craft.config.testToEmailAddress }}\n{{ craft.config.useEmailAsUsername }}\n{{ craft.config.userSessionDuration }}\n{{ craft.config.verificationCodeDuration }}\n\n{# Assets Settings #}\n{{ craft.config.allowedFileExtensions }}\n{{ craft.config.defaultImageQuality }}\n{{ craft.config.extraAllowedFileExtensions }}\n{{ craft.config.filenameWordSeparator }}\n{{ craft.config.generateTransformsBeforePageLoad }}\n{{ craft.config.imageDriver }}\n{{ craft.config.maxCachedCloudImageSize }}\n{{ craft.config.maxUploadFileSize }}\n{{ craft.config.rotateImagesOnUploadByExifData }}\n{{ craft.config.generateTransformsBeforePageLoad }}\n\n$0\n\n", 132 | "description": "info: craft.config", 133 | "scope": "text.html.twig" 134 | }, 135 | "entrieso": { 136 | "prefix": "entrieso", 137 | "body": "{% set entries = craft.entries({\n\tsection: '${1:sectionName}',\n\tlimit: '${2:10}'\n}) %}\n\n{% for entry in entries %}\n\t{{ entry.title }}\n{% endfor %}\n$0", 138 | "description": "craft.entries - object syntax", 139 | "scope": "text.html.twig" 140 | }, 141 | "entries": { 142 | "prefix": "entries", 143 | "body": "{% for entry in craft.entries\n\t.section('${1:sectionName}')\n\t.limit(${2:10})\n\t%}\n\t{{ entry.title }}\n{% endfor %}\n$0", 144 | "description": "craft.entries", 145 | "scope": "text.html.twig" 146 | }, 147 | "feed": { 148 | "prefix": "feed", 149 | "body": "{% set feedUrl = \"${1:http://feeds.feedburner.com/blogandtonic}\" %}\n{% set limit = ${2:10} %}\n{% set items = craft.feeds.getFeedItems(feedUrl, limit) %}\n\n{% for item in items %}\n\t
\n\t\t

{{ item.title }}

\n\t\t

{{ item.authors[0].name }}

\n\t\t

{{ item.date }}

\n\n\t\t{{ item.summary }}\n\t
\n{% endfor %}", 150 | "description": "feed", 151 | "scope": "text.html.twig" 152 | }, 153 | "info1": { 154 | "prefix": "info", 155 | "body": "{% set body = craft.fields.getFieldByHandle('body') %}\n{{ body.instructions }}", 156 | "description": "info: craft.fields", 157 | "scope": "text.html.twig" 158 | }, 159 | "info2": { 160 | "prefix": "info", 161 | "body": "{% set globals = craft.globals.getAllSets() %}\n{% set globals = craft.globals.getEditableSets() %}\n{% set globals = craft.globals.getTotalSets() %}\n{% set globals = craft.globals.getTotalEditableSets() %}\n{% set globalSet = craft.globals.getSetById( id, locale ) %}\n{% set globalSet = craft.globals.getSetByHandle( handle, locale ) %}", 162 | "description": "info: craft.globals", 163 | "scope": "text.html.twig" 164 | }, 165 | "info3": { 166 | "prefix": "info", 167 | "body": "{% set sections = craft.sections.getAllSections() %}\n{% set sections = craft.sections.getEditableSections() %}\n{% set total = craft.sections.getTotalSections() %}\n{% set total = craft.sections.getTotalEditableSections() %}\n{% set section = craft.sections.getSectionById( sectionId ) %}\n{% set section = craft.sections.getSectionByHandle( handle ) %}", 168 | "description": "info: craft.sections", 169 | "scope": "text.html.twig" 170 | }, 171 | "info4": { 172 | "prefix": "info", 173 | "body": "{% if craft.session.isLoggedIn %}{% endif %}\n\n{{ craft.session.getRememberedUsername }}\n{{ craft.session.getReturnUrl }}\n\n{{ craft.session.getFlash( key, defaultValue, delete ) }}\n{{ craft.session.getFlash( key, defaultValue, false ) }}\n{{ craft.session.getFlashes( delete ) }}\n{{ craft.session.getFlashes( false ) }}\n\n{% if craft.session.hasFlash() %}{% endif %}", 174 | "description": "info: craft.session", 175 | "scope": "text.html.twig" 176 | }, 177 | "t": { 178 | "prefix": "t", 179 | "body": "{{ $1|t }}$0", 180 | "description": "translate with |t" 181 | }, 182 | "replace": { 183 | "prefix": "replace", 184 | "body": "{{ ${1:$TM_SELECTED_TEXT} | replace('search', 'replace') }}$0", 185 | "description": "replace with | replace('search', 'replace')" 186 | }, 187 | "replacex": { 188 | "prefix": "replacex", 189 | "body": "{{ ${1:$TM_SELECTED_TEXT} | replace('/(search)/i', 'replace') }}$0", 190 | "description": "replace regex with | replace('/(search)/i', 'replace')" 191 | }, 192 | "split": { 193 | "prefix": "split", 194 | "body": "{{ ${1:$TM_SELECTED_TEXT} | split('\\n') }}$0", 195 | "description": "split on | split ('\\n')" 196 | }, 197 | "tagso": { 198 | "prefix": "tagso", 199 | "body": "{% set tags = craft.tags({\n\tgroup: '${1:tagGroupHandle}'\n}) %}\n\n\n$0", 200 | "description": "craft.tags - object syntax", 201 | "scope": "text.html.twig" 202 | }, 203 | "tags": { 204 | "prefix": "tags", 205 | "body": "\n$0", 206 | "description": "craft.tags", 207 | "scope": "text.html.twig" 208 | }, 209 | "userso": { 210 | "prefix": "userso", 211 | "body": "{% set users = craft.users({\n\tgroup: '${1:userGroupHandle}'\n}) %}\n\n{% for user in users %}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", 212 | "description": "craft.users - object syntax", 213 | "scope": "text.html.twig" 214 | }, 215 | "users": { 216 | "prefix": "users", 217 | "body": "{% for user in craft.users\n\t.group('${1:userGroupHandle}')\n\t%}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", 218 | "description": "craft.users", 219 | "scope": "text.html.twig" 220 | }, 221 | "csrf": { 222 | "prefix": "csrf", 223 | "body": "{{ getCsrfInput() }}\n$0", 224 | "description": "csrf", 225 | "scope": "text.html.twig" 226 | }, 227 | "dd": { 228 | "prefix": "dd", 229 | "body": "
\n\t{{ dump($1) }}\n
\n{% exit %}$0", 230 | "description": "dump and die", 231 | "scope": "text.html.twig" 232 | }, 233 | "do": { 234 | "prefix": "do", 235 | "body": "{% do $1 %}$0", 236 | "description": "do", 237 | "scope": "text.html.twig" 238 | }, 239 | "dump": { 240 | "prefix": "dump", 241 | "body": "
\n\t{{ dump($1) }}\n
", 242 | "description": "dump", 243 | "scope": "text.html.twig" 244 | }, 245 | "else": { 246 | "prefix": "else", 247 | "body": "{% else %}\n\t$0", 248 | "description": "else", 249 | "scope": "text.html.twig" 250 | }, 251 | "embed": { 252 | "prefix": "embed", 253 | "body": "{% embed \"${1:template}\" %}\n\t$0\n{% endembed %}", 254 | "description": "embed", 255 | "scope": "text.html.twig" 256 | }, 257 | "endautoescape": { 258 | "prefix": "endautoescape", 259 | "body": "endautoescape", 260 | "description": "endautoescape", 261 | "scope": "text.html.twig" 262 | }, 263 | "endblock": { 264 | "prefix": "endblock", 265 | "body": "{% endblock %}$0", 266 | "description": "endblock", 267 | "scope": "text.html.twig" 268 | }, 269 | "endcache": { 270 | "prefix": "endcache", 271 | "body": "{% endcache %}$0", 272 | "description": "endcache", 273 | "scope": "text.html.twig" 274 | }, 275 | "endembed": { 276 | "prefix": "endembed", 277 | "body": "{% endembed %}$0", 278 | "description": "endembed", 279 | "scope": "text.html.twig" 280 | }, 281 | "endfilter": { 282 | "prefix": "endfilter", 283 | "body": "{% endfilter %}$0", 284 | "description": "endfilter", 285 | "scope": "text.html.twig" 286 | }, 287 | "endfor": { 288 | "prefix": "endfor", 289 | "body": "{% endfor %}$0", 290 | "description": "endfor", 291 | "scope": "text.html.twig" 292 | }, 293 | "endfor1": { 294 | "prefix": "endfor", 295 | "body": "{% endfor %}$0", 296 | "description": "text.html.twig" 297 | }, 298 | "endif": { 299 | "prefix": "endif", 300 | "body": "{% endif %}$0", 301 | "description": "endif", 302 | "scope": "text.html.twig" 303 | }, 304 | "endif1": { 305 | "prefix": "endif", 306 | "body": "{% endif %}$0", 307 | "description": "else", 308 | "scope": "text.html.twig" 309 | }, 310 | "endifchildren": { 311 | "prefix": "endifchildren", 312 | "body": "{% endifchildren %}$0", 313 | "description": "endifchildren", 314 | "scope": "text.html.twig" 315 | }, 316 | "endincludecss": { 317 | "prefix": "endincludecss", 318 | "body": "{% endincludecss %}$0", 319 | "description": "endincludecss", 320 | "scope": "text.html.twig" 321 | }, 322 | "endincludehirescss": { 323 | "prefix": "endincludehirescss", 324 | "body": "{% endincludehirescss %}$0", 325 | "description": "endincludehirescss", 326 | "scope": "text.html.twig" 327 | }, 328 | "endincludejs": { 329 | "prefix": "endincludejs", 330 | "body": "{% endincludejs %}$0", 331 | "description": "endincludejs", 332 | "scope": "text.html.twig" 333 | }, 334 | "endmacro": { 335 | "prefix": "endmacro", 336 | "body": "{% endmacro %}$0", 337 | "description": "endmacro", 338 | "scope": "text.html.twig" 339 | }, 340 | "endnav": { 341 | "prefix": "endnav", 342 | "body": "{% endnav %}$0", 343 | "description": "endnav", 344 | "scope": "text.html.twig" 345 | }, 346 | "endset": { 347 | "prefix": "endset", 348 | "body": "{% endset %}$0", 349 | "description": "endset", 350 | "scope": "text.html.twig" 351 | }, 352 | "endspaceless": { 353 | "prefix": "endspaceless", 354 | "body": "{% endspaceless %}$0", 355 | "description": "endspaceless", 356 | "scope": "text.html.twig" 357 | }, 358 | "endswitch": { 359 | "prefix": "endswitch", 360 | "body": "{% endswitch %}$0", 361 | "description": "endswitch", 362 | "scope": "text.html.twig" 363 | }, 364 | "endverbatim": { 365 | "prefix": "endverbatim", 366 | "body": "{% endverbatim %}$0", 367 | "description": "endverbatim", 368 | "scope": "text.html.twig" 369 | }, 370 | "exit": { 371 | "prefix": "exit", 372 | "body": "{% exit ${1:404} %}", 373 | "description": "exit", 374 | "scope": "text.html.twig" 375 | }, 376 | "extends": { 377 | "prefix": "extends", 378 | "body": "{% extends '${1:template}' %}$0", 379 | "description": "extends", 380 | "scope": "text.html.twig" 381 | }, 382 | "filterb": { 383 | "prefix": "filterb", 384 | "body": "{% filter ${1:name} %}\n\t$0\n{% endfilter %}", 385 | "description": "filter (block)", 386 | "scope": "text.html.twig" 387 | }, 388 | "filter": { 389 | "prefix": "filter", 390 | "body": "{% filter ${1:name} %}$0{% endfilter %}", 391 | "description": "filter", 392 | "scope": "text.html.twig" 393 | }, 394 | "floor": { 395 | "prefix": "floor", 396 | "body": "floor($1)$0", 397 | "description": "floor", 398 | "scope": "text.html.twig" 399 | }, 400 | "fore": { 401 | "prefix": "fore", 402 | "body": "{% for ${1:item} in ${2:items} %}\n\t$3\n{% else %}\n\t$0\n{% endfor %}", 403 | "description": "for ... else", 404 | "scope": "text.html.twig" 405 | }, 406 | "for": { 407 | "prefix": "for", 408 | "body": "{% for ${1:item} in ${2:items} %}\n\t$0\n{% endfor %}", 409 | "description": "for", 410 | "scope": "text.html.twig" 411 | }, 412 | "from": { 413 | "prefix": "from", 414 | "body": "{% from '${1:template}' import '${2:macro}' %}$0", 415 | "description": "from", 416 | "scope": "text.html.twig" 417 | }, 418 | "getfoothtml": { 419 | "prefix": "getfoothtml", 420 | "body": "{{ getFootHtml() }}\n$0", 421 | "description": "getfoothtml", 422 | "scope": "text.html.twig" 423 | }, 424 | "getheadhtml": { 425 | "prefix": "getheadhtml", 426 | "body": "{{ getHeadHtml() }}\n$0", 427 | "description": "getheadhtml", 428 | "scope": "text.html.twig" 429 | }, 430 | "if": { 431 | "prefix": "if", 432 | "body": "{% if ${1:condition} %}$2{% endif %}\n$0", 433 | "description": "if", 434 | "scope": "text.html.twig" 435 | }, 436 | "ifb": { 437 | "prefix": "ifb", 438 | "body": "{% if ${1:condition} %}\n\t$0\n{% endif %}", 439 | "description": "if (block)", 440 | "scope": "text.html.twig" 441 | }, 442 | "ife": { 443 | "prefix": "ife", 444 | "body": "{% if ${1:condition} %}\n\t$2\n{% else %}\n\t$0\n{% endif %}", 445 | "description": "if ... else", 446 | "scope": "text.html.twig" 447 | }, 448 | "if1": { 449 | "prefix": "if", 450 | "body": "{% if ${1:condition} %}$0{% endif %}", 451 | "description": "if", 452 | "scope": "text.html.twig" 453 | }, 454 | "ifchildren": { 455 | "prefix": "ifchildren", 456 | "body": "{% ifchildren %}\n\t$1\n{% endifchildren %}\n$0", 457 | "description": "ifchildren", 458 | "scope": "text.html.twig" 459 | }, 460 | "import": { 461 | "prefix": "import", 462 | "body": "{% import '${1:template}' as ${2:name} %}$0", 463 | "description": "import", 464 | "scope": "text.html.twig" 465 | }, 466 | "importself": { 467 | "prefix": "importself", 468 | "body": "{% import _self as ${1:name} %}$0", 469 | "description": "importself", 470 | "scope": "text.html.twig" 471 | }, 472 | "inckv": { 473 | "prefix": "inckv", 474 | "body": "{% include '${1:template}' with {\n\t${2:key}: ${3:'${4:value}'}\n} %}\n$0", 475 | "description": "include w/ key/value", 476 | "scope": "text.html.twig" 477 | }, 478 | "include": { 479 | "prefix": "include", 480 | "body": "{% include '${1:template}' %}$0", 481 | "description": "include", 482 | "scope": "text.html.twig" 483 | }, 484 | "inc": { 485 | "prefix": "inc", 486 | "body": "{% include '${1:template}' %}$0", 487 | "description": "inc", 488 | "scope": "text.html.twig" 489 | }, 490 | "incp": { 491 | "prefix": "incp", 492 | "body": "{% include '${1:template}'${2: with ${3:params} }%}$0", 493 | "description": "include w/ params", 494 | "scope": "text.html.twig" 495 | }, 496 | "includecss": { 497 | "prefix": "includecss", 498 | "body": "{% includeCssFile \"${1:/resources/css/global.css}\" %}\n$0", 499 | "description": "includeCssFile", 500 | "scope": "text.html.twig" 501 | }, 502 | "includecss1": { 503 | "prefix": "includecss", 504 | "body": "{% includehirescss %}\n\t$1\n{% endincludehirescss %}\n$0", 505 | "description": "includeCssHiRes", 506 | "scope": "text.html.twig" 507 | }, 508 | "includejs": { 509 | "prefix": "includejs", 510 | "body": "{% includejs %}\n\t$1\n{% endincludejs %}\n$0", 511 | "description": "includeJs", 512 | "scope": "text.html.twig" 513 | }, 514 | "includejs1": { 515 | "prefix": "includejs", 516 | "body": "{% includeJsFile \"${1:/resources/js/global.js}\" %}\n$0", 517 | "description": "includeJsFile", 518 | "scope": "text.html.twig" 519 | }, 520 | "includecss2": { 521 | "prefix": "includecss", 522 | "body": "{% includecss %}\n\t$1\n{% endincludecss %}\n$0", 523 | "description": "includeCss", 524 | "scope": "text.html.twig" 525 | }, 526 | "info5": { 527 | "prefix": "info", 528 | "body": "\n{% set assets = craft.assets.first() %}\n{% set assets = craft.assets.last() %}\n{% set assets = craft.assets.nth( n ) %}\n{% set assets = craft.assets.ids() %}\n{% set assets = craft.assets.total() %}\n\n{% set assets = craft.assets.find({\n\n\tfilename: 'fileName.jpg',\n\tfixedOrder: true|false,\n\tfolderId: id,\n\theight: 200,\n\tid: id,\n\tkind: http://buildwithcraft.com/docs/templating/craft.assets#kind,\n\toffset: 1,\n\tsize: 1000,\n\ttitle: 'title',\n\tsource: 'assetSourceHandle'\n\tsourceId: id,\n\twidth: 200,\n\n\trelatedTo: element, sourceElement, targetElement, field, sourceLocale,\n\tchildOf: See supported syntaxes below,\n\tchildField: 'fieldHandle' OR id,\n\tparentOf: See supported syntaxes below,\n\tparentField: 'fieldHandle' OR id,\n\n\torder: 'title,id,sourceId,folderId,filename,kind,width,height,size,\n\t\t\t\t\t\t\tdateCreated asc,dateUpdated desc', \n\t\t\t\t\t\t\tAlso supports any textual field handles\n\tlimit: 100,\n\tlocale: 'en_us',\n\tindexBy: 'id,title',\n\n\tsearch: 'salty dog' containing both \"salty\" and \"dog\"\n\t\t\t\t\t\t\t'\"salty dog\"' containing the exact phrase \"salty dog\"\n\t\t\t\t\t\t\t'salty OR dog' containing either \"salty\" or \"dog\" (or both)\n\t\t\t\t\t\t\t'salty -dog' containing \"salty\" but not \"dog\"\n\t\t\t\t\t\t\t'body:salty' containing \"salty\" in the \"body\" field\n\t\t\t\t\t\t\t'body:salty' body:dog containing both \"salty\" and \"dog\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tin the \"body\" field\n\t\t\t\t\t\t\t'body:*' containing anything within the \"body\" field\n\t\t\t\t\t\t\t'salty locale:en_us' containing \"salty\" in the locale \"en_us\"\n\t\t\t\t\t\t\t'salt*' containing a word that begins with \"salt\"\n\t\t\t\t\t\t\t'*ty' containing a word that ends with \"ty\"\n\t\t\t\t\t\t\t'*alt*' containing a word that contains \"alt\",\n\n\tSupported syntaxes for childOf, kind, parentOf\n\t\t\t\t\t\t\telementId\n\t\t\t\t\t\t\tAssetFileModel, EntryModel, UserModel, or TagModel\n\t\t\t\t\t\t\t[ arrayOfModels, arrayOfModels, arrayOfModels ]\n\t\t\t\t\t\t\t[ 1, 2, 3 ]\n\t\t\t\t\t\t\tcraft.assets, craft.entries, craft.users, craft.tags\n}) %}\n\n{% for asset in assets %}\n\n\t{{ asset.dateCreated }}\n\t{{ asset.dateUpdated }}\n\t{{ asset.extension }}\n\t{{ asset.filename }}\n\t{{ asset.folder }}\n\t{{ asset.folderId }}\n\t{{ asset.height }}\n\t{{ asset.id }}\n\t{{ asset.img }}\n\t{{ asset.kind }}\n\t{{ asset.locale }}\n\t{{ asset.link }}\n\t{{ asset.mimeType }}\n\t{{ asset.size | filesize }}\n\t{{ asset.source }}\n\t{{ asset.sourceId }}\n\t{{ asset.url }}\n\t{{ asset.width }}\n\t\n\t{{ asset.getHeight( transform ) }}\n\t{{ asset.getWidth( transform ) }}\n\t{{ asset.getUrl( transform ) }}\n\t{{ asset.setTransform( transform ) }}\n\n\t{% set prev = asset.getPrev( params ) %}\n\t{% set next = asset.getNext( params ) %}\n\t{% if prev %} {{ prev.title }} {% endif %}\n\t{% if next %} {{ next.title }} {% endif %}\n\t\n{% endfor %}}\n$0", 529 | "description": "info: craft.assets", 530 | "scope": "text.html.twig" 531 | }, 532 | "info6": { 533 | "prefix": "info", 534 | "body": "\n{% set categories = craft.categories.first() %}\n{% set categories = craft.categories.last() %}\n{% set categories = craft.categories.nth( n ) %}\n{% set categories = craft.categories.ids() %}\n{% set categories = craft.categories.total() %}\n\n{% set categories = craft.categories.find({\n\tid: id OR 'not id' ,\n\tfixedOrder: true/false,\n\ttitle: 'title',\n\tslug: 'slug', \n\turi: 'uri', \n\tgroup: 'categoryGroupHandle'\n\tgroupId: id,\n\tstatus: 'live,pending,expired,disabled,null',\n\toffset: 10,\n\tlevel: 2,\n\tlocale: 'en_us',\n\n\trelatedTo: element, sourceElement, targetElement, field, sourceLocale,\n\tancestorOf: CategoryModel OR id,\n\tancestorDist: 2,\n\tdescendantOf: CategoryModel OR id,\n\tdescendantDist: 2,\n\tnextSiblingOf: CategoryModel OR id,\n\tprevSiblingOf: CategoryModel OR id,\n\t\n\torder: 'title,id,groupId,slug,uri,\n\t\t\t\t\t\t\t\t\t dateCreated asc,dateUpdated desc',\n\tlimit: 10,\n\tindexBy: 'id,title',\n\n\tsearch: 'salty dog' containing both \"salty\" and \"dog\"\n\t\t\t\t\t\t\t\t\t'\"salty dog\"' containing the exact phrase \"salty dog\"\n\t\t\t\t\t\t\t\t\t'salty OR dog' containing either \"salty\" or \"dog\" (or both)\n\t\t\t\t\t\t\t\t\t'salty -dog' containing \"salty\" but not \"dog\"\n\t\t\t\t\t\t\t\t\t'body:salty' containing \"salty\" in the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:salty' body:dog containing both \"salty\" and \"dog\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tin the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:*' containing anything within the \"body\" field\n\t\t\t\t\t\t\t\t\t'salty locale:en_us' containing \"salty\" in the locale \"en_us\"\n\t\t\t\t\t\t\t\t\t'salt*' containing a word that begins with \"salt\"\n\t\t\t\t\t\t\t\t\t'*ty' containing a word that ends with \"ty\"\n\t\t\t\t\t\t\t\t\t'*alt*' containing a word that contains \"alt\"\n\n}) %}\n\n{% for category in categories %}\n\n\t{{ category.id }}\n\t{{ category.level }}\n\t{{ category.groupId }}\n\t{{ category.group }} {# array #}\n\t{{ category.locale }}\n\t{{ category.title }}\n\t{{ category.slug }}\n\t{{ category.uri }}\n\t{{ category.url }} {# full front-end URL #}\n\t{{ category.link }} {# full tag #}\n\t{{ category.cpEditUrl }}\n\t\n\t{{ category.enabled }}\n\t{{ category.status }}\n\n\t{{ category.dateCreated }}\n\t{{ category.dateUpdated }}\n\t\n\t{{ category.getAncestors( distance ) }}\n\t{{ category.getDescendants( distance) }}\n\t{{ category.children }} \n\t{{ category.parent }}\n\t{{ category.hasDescendants }}\n\t{{ category.nextSibling }}\n\t{{ category.prevSibling }}\n\t{{ category.isAncestorOf( entry ) }}\n\t{{ category.isChildOf( entry ) }}\n\t{{ category.isDescendantOf( entry ) }}\n\t{{ category.isNextSiblingOf( entry ) }}\n\t{{ category.isParentOf( entry ) }}\n\t{{ category.isPrevSiblingOf( entry ) }}\n\t{{ category.isSiblingOf( entry ) }}\n\t\n\t{% set prev = category.getPrev( params ) %}\n\t{% set next = category.getNext( params ) %}\n\t{% if prev %} {{ prev.title }} {% endif %}\n\t{% if next %} {{ next.title }} {% endif %}\n\n{% endfor %}}\n$0", 535 | "description": "info: craft.categories", 536 | "scope": "text.html.twig" 537 | }, 538 | "info7": { 539 | "prefix": "info", 540 | "body": "\n{% set entries = craft.entries.first() %}\n{% set entries = craft.entries.last() %}\n{% set entries = craft.entries.nth( n ) %}\n{% set entries = craft.entries.ids() %}\n{% set entries = craft.entries.total() %}\n\n{% set entries = craft.entries.find({\n\tid: id OR 'not id' ,\n\tfixedOrder: true/false,\n\tslug: 'slug', \n\turi: 'uri', \n\tsectionId: id,\n\tsection: 'sectionHandle', [arrayOfSectionHandles], SectionModel\n\tauthorId: id,\n\tauthorGroupId: id,\n\tauthorGroup: id,\n\tpostDate: 'YYYY,YYYY-MM,YYYY-MM-DD,YYYY-MM-DD HH:MM,YYYY-MM-DD HH:MM:SS',\n\tafter: 'YYYY,YYYY-MM,YYYY-MM-DD,YYYY-MM-DD HH:MM,YYYY-MM-DD HH:MM:SS',\n\tbefore: 'Unix timestamp,DateTime variable',\n\tstatus: 'live,pending,expired,disabled,null',\n\ttype: 'entryTypeHandle',\n\tarchived: true OR false,\n\toffset: 10,\n\tlevel: 2,\n\tlocale: 'en_us',\n\tlocaleEnabled: true/false,\n\n\trelatedTo: element, sourceElement, targetElement, field, sourceLocale,\n\tancestorOf: EntryModel OR id,\n\tancestorDist: 2,\n\tdescendantOf: EntryModel OR id,\n\tdescendantDist: 2,\n\tnextSiblingOf: EntryModel OR id,\n\tprevSiblingOf: EntryModel OR id,\n\t\n\torder: 'title,id,authorId,sectionId,slug,uri,postDate,expiryDate',\n\t\t\t\t\t\t\t\t\t'dateCreated asc', 'dateUpdated desc'\n\tlimit: 10,\n\tindexBy: 'id,title',\n\n\tsearch: 'salty dog' containing both \"salty\" and \"dog\"\n\t\t\t\t\t\t\t\t\t'\"salty dog\"' containing the exact phrase \"salty dog\"\n\t\t\t\t\t\t\t\t\t'salty OR dog' containing either \"salty\" or \"dog\" (or both)\n\t\t\t\t\t\t\t\t\t'salty -dog' containing \"salty\" but not \"dog\"\n\t\t\t\t\t\t\t\t\t'body:salty' containing \"salty\" in the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:salty' body:dog containing both \"salty\" and \"dog\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tin the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:*' containing anything within the \"body\" field\n\t\t\t\t\t\t\t\t\t'salty locale:en_us' containing \"salty\" in the locale \"en_us\"\n\t\t\t\t\t\t\t\t\t'salt*' containing a word that begins with \"salt\"\n\t\t\t\t\t\t\t\t\t'*ty' containing a word that ends with \"ty\"\n\t\t\t\t\t\t\t\t\t'*alt*' containing a word that contains \"alt\"\n\n\tSupported syntaxes for childOf, kind, parentOf\n\t\t\t\t\t\t\t\t\telementId\n\t\t\t\t\t\t\t\t\tAssetFileModel, EntryModel, UserModel, or TagModel\n\t\t\t\t\t\t\t\t\t[ arrayOfModels, arrayOfModels, arrayOfModels ]\n\t\t\t\t\t\t\t\t\t[ 1, 2, 3 ]\n\t\t\t\t\t\t\t\t\tcraft.assets, craft.entries, craft.users, craft.tags\n\n}) %}\n\n{% for entry in entries %}\n\n\t{{ entry.id }}\n\t{{ entry.level }}\n\t{{ entry.sectionId }}\n\t{{ entry.section }} {# array #}\n\t{{ entry.authorId }}\n\t{{ entry.author }} {# array #}\n\t{{ entry.locale }}\n\t{{ entry.type }}\n\t{{ entry.title }}\n\t{{ entry.slug }}\n\t{{ entry.uri }}\n\t{{ entry.url }} {# full front-end URL #}\n\t{{ entry.link }} {# full tag #}\n\t{{ entry.cpEditUrl }}\n\t\n\t{{ entry.enabled }}\n\t{{ entry.status }}\n\n\t{{ entry.postDate }}\n\t{{ entry.expiryDate }}\n\t{{ entry.dateCreated }}\n\t{{ entry.dateUpdated }}\n\t\n\t{{ entry.getAncestors( distance ) }}\n\t{{ entry.getDescendants( distance) }}\n\t{{ entry.children }}\n\t{{ entry.parent }}\n\t{{ entry.hasDescendants }}\n\t{{ entry.nextSibling }}\n\t{{ entry.prevSibling }}\n\t{{ entry.isAncestorOf( entry ) }}\n\t{{ entry.isChildOf( entry ) }}\n\t{{ entry.isDescendantOf( entry ) }}\n\t{{ entry.isNextSiblingOf( entry ) }}\n\t{{ entry.isParentOf( entry ) }}\n\t{{ entry.isPrevSiblingOf( entry ) }}\n\t{{ entry.isSiblingOf( entry ) }}\n\t\n\t{% set prev = entry.getPrev( params ) %}\n\t{% set next = entry.getNext( params ) %}\n\t{% if prev %} {{ prev.title }} {% endif %}\n\t{% if next %} {{ next.title }} {% endif %}\n\n{% endfor %}}\n$0", 541 | "description": "info: craft.entries", 542 | "scope": "text.html.twig" 543 | }, 544 | "info8": { 545 | "prefix": "info", 546 | "body": "{# Required #}\n{% set feedUrl = \"http://feeds.feedburner.com/blogandtonic\" %}\n\n{# Option #}\n{% set limit = 10 %} {# How many items to return. Default: All #}\n{% set skip = 0 %} {# How many items to skip. Default: Zero #}\n\n{% set items = craft.feeds.getFeedItems( url, limit, offset, cacheDuration ) %}\n\n{% for item in items %}\n\t\n\t{{ title }}\n\t{{ summary }}\n\t{{ content }}\n\n\t{{ date }}\n\t{{ dateUpdated }}\n\t{{ permalink }}\n\t\n\t{{ authors }} {# array #}\n\t{{ authors[0].name }}\n\t{{ authors[0].url }}\n\t{{ authors[0].email }}\n\n\t{{ contributors }} {# array #}\n\t{{ contributors[0].name }}\n\t{{ contributors[0].url }}\n\t{{ contributors[0].email }}\n\n\t{{ categories }} {# array #}\n\t{{ categories[0].term }}\n\t{{ categories[0].scheme }}\n\t{{ categories[0].label }}\n\n{% endfor %}\n$0", 547 | "description": "info: craft.feeds", 548 | "scope": "text.html.twig" 549 | }, 550 | "info9": { 551 | "prefix": "info", 552 | "body": "{# Properties #}\n{{ craft.request.isAjax }}\n{{ craft.request.isLivePreview }}\n{{ craft.request.isSecure }}\n\n{{ craft.request.path }}\n{{ craft.request.url }}\n{{ craft.request.urlReferrer }}\n{{ craft.request.pageNum }}\n\n{{ craft.request.queryString }}\n{{ craft.request.queryStringWithoutPath }}\n{{ craft.request.segments }} {# array #}\n\n{{ craft.request.firstSegment }}\n{{ craft.request.lastSegment }}\n\n{{ craft.request.serverName }}\n\n{# Methods #}\n{{ craft.request.isMobileBrowser() }}\n\n{{ craft.request.getSegment( n ) }}\n{{ craft.request.getCookie( name ) }}\n{{ craft.request.getParam( name ) }} {# Returns a parameter from either the query string or POST data. #}\n{{ craft.request.getQuery( name ) }} {# Returns a parameter from the query string. #}\n{{ craft.request.getPost( name ) }} {# Returns a parameter from the POST data. #}\n\n$0", 553 | "description": "info: craft.request", 554 | "scope": "text.html.twig" 555 | }, 556 | "info10": { 557 | "prefix": "info", 558 | "body": "\n{% set tags = craft.tags.first() %}\n{% set tags = craft.tags.last() %}\n{% set tags = craft.tags.nth( n ) %}\n{% set tags = craft.tags.ids() %}\n{% set tags = craft.tags.total() %}\n\n{% set tags = craft.tags.find({\n\tid: id OR 'not id' ,\n\tfixedOrder: true|false,\n\ttitle: 'title',\n\tgroup: 'tagGroupHandle', \n\tgroupId: id,\n\toffset: 2,\n\t\n\trelatedTo: element, sourceElement, targetElement, field, sourceLocale,\n\n\torder: 'title,id,groupId,dateCreated asc,dateUpdated desc',\n\tlimit: 10,\n\tlocale: 'en_us',\n\tindexBy: 'id,title',\n\n\tsearch: 'salty dog' containing both \"salty\" and \"dog\"\n\t\t\t\t\t\t\t\t\t'\"salty dog\"' containing the exact phrase \"salty dog\"\n\t\t\t\t\t\t\t\t\t'salty OR dog' containing either \"salty\" or \"dog\" (or both)\n\t\t\t\t\t\t\t\t\t'salty -dog' containing \"salty\" but not \"dog\"\n\t\t\t\t\t\t\t\t\t'body:salty' containing \"salty\" in the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:salty' body:dog containing both \"salty\" and \"dog\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tin the \"body\" field\n\t\t\t\t\t\t\t\t\t'body:*' containing anything within the \"body\" field\n\t\t\t\t\t\t\t\t\t'salty locale:en_us' containing \"salty\" in the locale \"en_us\"\n\t\t\t\t\t\t\t\t\t'salt*' containing a word that begins with \"salt\"\n\t\t\t\t\t\t\t\t\t'*ty' containing a word that ends with \"ty\"\n\t\t\t\t\t\t\t\t\t'*alt*' containing a word that contains \"alt\"\n\n\tSupported syntaxes for childOf, kind, parentOf\n\t\t\t\t\t\t\t\t\telementId\n\t\t\t\t\t\t\t\t\tAssetFileModel, EntryModel, UserModel, or TagModel\n\t\t\t\t\t\t\t\t\t[ arrayOfModels, arrayOfModels, arrayOfModels ]\n\t\t\t\t\t\t\t\t\t[ 1, 2, 3 ]\n\t\t\t\t\t\t\t\t\tcraft.assets, craft.entries, craft.users, craft.tags\n\n}) %}\n\n{% for tag in tags %}\n\n\t{{ tag.id }}\n\t{{ tag.title }}\n\t{{ tag.group }}\n\t{{ tag.groupId }}\n\t{{ tag.locale }}\n\n\t{% set prev = tag.getPrev( params ) %}\n\t{% set next = tag.getNext( params ) %}\n\t{% if prev %} {{ prev.name }} {% endif %}\n\t{% if next %} {{ next.name }} {% endif %}\n\n{% endfor %}}\n$0", 559 | "description": "info: craft.tags", 560 | "scope": "text.html.twig" 561 | }, 562 | "info11": { 563 | "prefix": "info", 564 | "body": "\n{% set users = craft.users.first() %}\n{% set users = craft.users.last() %}\n{% set users = craft.users.nth( n ) %}\n{% set users = craft.users.ids() %}\n{% set users = craft.users.total() %}\n\n{% set users = craft.users.find({\n admin: true OR false,\n can: 'createEntries:5'\n email: 'email',\n firstName: 'firstName',\n group: 'groupHandle', \n groupId: id,\n id: id OR 'not id',\n fixedOrder: true|false,\n lastLoginDate: 'YYYY,YYYY-MM,YYYY-MM-DD,YYYY-MM-DD HH:MM,YYYY-MM-DD HH:MM:SS',\n lastName: 'lastName',\n offset: 1,\n status: 'active,locked,suspended,pending,archived,null',\n username: 'username,\n \n relatedTo: element, sourceElement, targetElement, field, sourceLocale,\n \n order: 'username,firstName,lastName,email,preferredLocale,status,lastLoginDate,\n dateCreated asc,dateUpdated desc', \n limit: number,\n indexBy: 'id,username'\n\n search: 'salty dog' containing both \"salty\" and \"dog\"\n '\"salty dog\"' containing the exact phrase \"salty dog\"\n 'salty OR dog' containing either \"salty\" or \"dog\" (or both)\n 'salty -dog' containing \"salty\" but not \"dog\"\n 'body:salty' containing \"salty\" in the \"body\" field\n 'body:salty' body:dog containing both \"salty\" and \"dog\" \n in the \"body\" field\n 'body:*' containing anything within the \"body\" field\n 'salty locale:en_us' containing \"salty\" in the locale \"en_us\"\n 'salt*' containing a word that begins with \"salt\"\n '*ty' containing a word that ends with \"ty\"\n '*alt*' containing a word that contains \"alt\",\n\n}) %}\n\n{% for user in users %}\n \n {{ user.id }}\n {{ user.username }}\n {{ user.name }}\n {{ user.firstName }}\n {{ user.lastName }}\n {{ user.fullName }}\n {{ user.friendlyName }} {# falls back to username #}\n {{ user.email }}\n \n {{ user.preferredLocale }}\n {{ user.admin }} {# true,false #}\n {{ user.status }} {# active, locked, suspended, pending, archived #}\n {{ user.isCurrent }} {# is currently logged in #}\n \n {{ user.lastLoginDate }}\n {{ user.dateCreated }}\n {{ user.dateUpdated }}\n\n {{ user.getChildren( fields ) }}\n {{ user.getParents( fields ) }}\n\n {{ user.getGroups() }}\n {{ user.isInGroup( groupHandle OR groupId OR UserGroupModel ) }}\n {{ user.getPhotoUrl( size ) }}\n {{ user.isCurrent() }}\n {{ user.can( 'permission' ) }}\n\n {% set prev = user.getPrev( params ) %}\n {% set next = user.getNext( params ) %}\n {% if prev %} {{ prev.username }} {% endif %}\n {% if next %} {{ next.username }} {% endif %}\n\n{% endfor %}}\n$0", 565 | "description": "info: craft.users", 566 | "scope": "text.html.twig" 567 | }, 568 | "info12": { 569 | "prefix": "info", 570 | "body": "\nSITE\n{{ siteName }}\n{{ siteUrl }}\n{{ loginUrl }}\n{{ logoutUrl }}\n\nDATE\n{{ now.year }}\n{{ now.month }}\n{{ now.day }}\n{{ now|date(\"M d, Y\") }}\n{{ now|date_modify(\"+1 day\") }}\n\nUSERS\n{{ currentUser }} {# null if no user is logged in #}\n{{ currentUser.id }}\n{{ currentUser.username }}\n{{ currentUser.firstName }}\n{{ currentUser.lastName }}\n{{ currentUser.friendlyName }}\n{{ currentUser.email }}\n{{ currentUser.preferredLocale }}\n{{ currentUser.admin }}\n{{ currentUser.status }} {# active, locked, suspended, pending, archived #}\n{{ currentUser.lastLoginDate }}\n{{ currentUser.dateCreated }}\n{{ currentUser.dateUpdated }}\n\n{{ currentUser.getChildren() }}\n{{ currentUser.getParents() }}\n\n{% set params = { group: 'authors', order: 'firstName, lastName' } %}\n{{ currentUser.getNext( params ) }}\n{{ currentUser.getPrev( params ) }}\n\nGLOBALS\n{{ globalSetName.fieldName }}\n\nTAGS\n{{ craft.assets }}\n{{ craft.categories }}\n{{ craft.entries }}\n{{ craft.tags }}\n{{ craft.user }}\n\n{{ craft.config }}\n{{ craft.feeds }}\n{{ craft.fields }}\n{{ craft.globals }}\n{{ craft.request }}\n{{ craft.sections }}\n{{ craft.session }}\n\n$0", 571 | "description": "info: globals", 572 | "scope": "text.html.twig" 573 | }, 574 | "macro": { 575 | "prefix": "macro", 576 | "body": "{% macro ${1:name}(${2:params}) %}\n\t$0\n{% endmacro %}", 577 | "description": "macro", 578 | "scope": "text.html.twig" 579 | }, 580 | "matrix": { 581 | "prefix": "matrix", 582 | "body": "{% for block in ${1:entry.matrixFieldHandle} %}\n\n\t{% if block.type == '${2:blockHandle}' %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == '${4:blockHandle}' %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", 583 | "description": "matrix", 584 | "scope": "text.html.twig" 585 | }, 586 | "matrixif": { 587 | "prefix": "matrixif", 588 | "body": "{% for block in ${1:entry.matrixFieldHandle} %}\n\n\t{% if block.type == '${2:blockHandle}' %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == '${4:blockHandle}' %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", 589 | "description": "matrixif", 590 | "scope": "text.html.twig" 591 | }, 592 | "matrixifelse": { 593 | "prefix": "matrixifelse", 594 | "body": "{% for block in ${1:entry.matrixFieldHandle} %}\n\n\t{% if block.type == '${2:blockHandle}' %}\n\n\t\t{{ block.${3:fieldHandle} }}\n\n\t{% elseif block.type == \"${4:blockHandle}\" %}\n\n\t\t$0\n\t\n\t{% endif %}\n\n{% endfor %}", 595 | "description": "matrixifelse", 596 | "scope": "text.html.twig" 597 | }, 598 | "matrixswitch": { 599 | "prefix": "matrixswitch", 600 | "body": "{% for block in ${1:entry.matrixFieldHandle} %}\n\n\t{% switch block.type %}\n\n\t\t{% case \"${2:blockHandle}\" %}\n\n\t\t\t{{ block.${3:fieldHandle} }}\n\n\t\t{% case \"${4:blockHandle}\" %}\n\n\t\t\t$0\n\n\t{% endswitch %}\n\n{% endfor %}", 601 | "description": "matrixswitch", 602 | "scope": "text.html.twig" 603 | }, 604 | "max": { 605 | "prefix": "max", 606 | "body": "max(${1:$2, $3})$0", 607 | "description": "max", 608 | "scope": "text.html.twig" 609 | }, 610 | "min": { 611 | "prefix": "min", 612 | "body": "min(${1:$2, $3})$0", 613 | "description": "min", 614 | "scope": "text.html.twig" 615 | }, 616 | "nav": { 617 | "prefix": "nav", 618 | "body": "{% nav ${1:item} in ${2:items} %}\n\t$3\n{% endnav %}\n$0", 619 | "description": "nav", 620 | "scope": "text.html.twig" 621 | }, 622 | "paginate": { 623 | "prefix": "paginate", 624 | "body": "{% paginate ${1:elements} as ${2:pageInfo}, ${3:name} %}\n\n{% for item in ${3:name} %}\n\t$0\n{% endfor %}\n\n{% if ${2:pageInfo}.prevUrl %}Previous Page{% endif %}\n{% if ${2:pageInfo}.nextUrl %}Next Page{% endif %}", 625 | "description": "paginate simple", 626 | "scope": "text.html.twig" 627 | }, 628 | "paginate1": { 629 | "prefix": "paginate", 630 | "body": "{# PAGINATION\n\t\t\nFor this pagination to work properly, we need to be sure to set\nthe paginateBase variable in the template we are including the \npagination in.\n\n{% set paginateBase = \"/blog/p\" %}\n#}\n\n{% if pageInfo.totalPages > 1 %}\n\n{% endif %}\n$0", 631 | "description": "paginate advanced", 632 | "scope": "text.html.twig" 633 | }, 634 | "redirect": { 635 | "prefix": "redirect", 636 | "body": "{% redirect '${1:template/path or http://straightupcraft.com}' %}\n$0", 637 | "description": "redirect", 638 | "scope": "text.html.twig" 639 | }, 640 | "getparam": { 641 | "prefix": "getparam", 642 | "body": "craft.request.getParam(${1:'Query String or Post Variable Name'})\n$0", 643 | "description": "request getParam", 644 | "scope": "text.html.twig" 645 | }, 646 | "getpost": { 647 | "prefix": "getpost", 648 | "body": "craft.request.getPost(${1:'postVariableName'})\n$0", 649 | "description": "request getPost", 650 | "scope": "text.html.twig" 651 | }, 652 | "getquery": { 653 | "prefix": "getquery", 654 | "body": "craft.request.getQuery(${1:'queryStringName'})\n$0", 655 | "description": "request getQuery", 656 | "scope": "text.html.twig" 657 | }, 658 | "getsegment": { 659 | "prefix": "getsegment", 660 | "body": "craft.request.getSegment(${1:2})\n$0", 661 | "description": "request getSegment", 662 | "scope": "text.html.twig" 663 | }, 664 | "requirelogin": { 665 | "prefix": "requirelogin", 666 | "body": "{% requireLogin %}\n$0", 667 | "description": "requireLogin", 668 | "scope": "text.html.twig" 669 | }, 670 | "requirepermission": { 671 | "prefix": "requirepermission", 672 | "body": "{% requirePermission \"${1:spendTheNight}\" %}\n$0", 673 | "description": "requirePermission", 674 | "scope": "text.html.twig" 675 | }, 676 | "round": { 677 | "prefix": "round", 678 | "body": "round($1)$0", 679 | "description": "round", 680 | "scope": "text.html.twig" 681 | }, 682 | "setb": { 683 | "prefix": "setb", 684 | "body": "{% set ${1:var} %}\n\t$0\n{% endset %}", 685 | "description": "set (block)", 686 | "scope": "text.html.twig" 687 | }, 688 | "set": { 689 | "prefix": "set", 690 | "body": "{% set ${1:var} = ${2:value} %}$0", 691 | "description": "set", 692 | "scope": "text.html.twig" 693 | }, 694 | "shuffle": { 695 | "prefix": "shuffle", 696 | "body": "shuffle($1)$0", 697 | "description": "shuffle", 698 | "scope": "text.html.twig" 699 | }, 700 | "random": { 701 | "prefix": "random", 702 | "body": "random($1)$0", 703 | "description": "random", 704 | "scope": "text.html.twig" 705 | }, 706 | "spaceless": { 707 | "prefix": "spaceless", 708 | "body": "{% spaceless %}\n\t$0\n{% endspaceless %}", 709 | "description": "spaceless", 710 | "scope": "text.html.twig" 711 | }, 712 | "switch": { 713 | "prefix": "switch", 714 | "body": "{% switch ${1:variable} %}\n\n\t{% case \"${2:value1}\" %}\n\t\n\n\t{% case \"${3:value2}\" %}\n\t\n\n\t{% default %}\n\t\n\n{% endswitch %}\n$0", 715 | "description": "switch", 716 | "scope": "text.html.twig" 717 | }, 718 | "%%": { 719 | "prefix": "%%", 720 | "body": "{% ${1:$TM_SELECTED_TEXT} %}$0", 721 | "description": "{% ... %}", 722 | "scope": "text.html.twig" 723 | }, 724 | "##": { 725 | "prefix": "##", 726 | "body": "{# ${1:$TM_SELECTED_TEXT} #}$0", 727 | "description": "{# ... #}", 728 | "scope": "text.html.twig" 729 | }, 730 | "}}": { 731 | "prefix": "}}", 732 | "body": "{{ ${1:$TM_SELECTED_TEXT} }}$0", 733 | "description": "{{ ... }}", 734 | "scope": "text.html.twig" 735 | }, 736 | "urla": { 737 | "prefix": "urla", 738 | "body": "url('${1:path}', ${2:{foo:'1', bar:'2'\\}}, ${3:'http'}, ${4:false})$0", 739 | "description": "url w/ arguments", 740 | "scope": "text.html.twig" 741 | }, 742 | "url": { 743 | "prefix": "url", 744 | "body": "url('${1:path}')$0", 745 | "description": "url", 746 | "scope": "text.html.twig" 747 | }, 748 | "use": { 749 | "prefix": "use", 750 | "body": "{% use '${1:template}' %}$0", 751 | "description": "use", 752 | "scope": "text.html.twig" 753 | }, 754 | "verbatim": { 755 | "prefix": "verbatim", 756 | "body": "{% verbatim %}\n\t$0\n{% endverbatim %}", 757 | "description": "verbatim", 758 | "scope": "text.html.twig" 759 | } 760 | } 761 | --------------------------------------------------------------------------------