├── app ├── templates │ ├── api_version_3_0 │ │ ├── tests │ │ │ ├── .gitignore │ │ │ ├── _craft │ │ │ │ ├── storage │ │ │ │ │ └── example-file.txt │ │ │ │ ├── config │ │ │ │ │ ├── routes.php │ │ │ │ │ ├── general.php │ │ │ │ │ ├── test.php │ │ │ │ │ └── db.php │ │ │ │ ├── .gitignore │ │ │ │ └── templates │ │ │ │ │ └── example.twig │ │ │ ├── unit │ │ │ │ ├── _bootstrap.php │ │ │ │ └── ExampleUnitTest.php │ │ │ ├── _support │ │ │ │ ├── .gitignore │ │ │ │ ├── Helper │ │ │ │ │ ├── Unit.php │ │ │ │ │ └── Functional.php │ │ │ │ ├── UnitTester.php │ │ │ │ └── FunctionalTester.php │ │ │ ├── functional │ │ │ │ ├── _bootstrap.php │ │ │ │ └── ExampleFunctionalCest.php │ │ │ ├── functional.suite.yml │ │ │ ├── unit.suite.yml │ │ │ ├── example-env │ │ │ └── _bootstrap.php │ │ ├── resources │ │ │ └── img │ │ │ │ └── plugin-logo.png │ │ ├── src │ │ │ ├── assetbundles │ │ │ │ ├── pluginresources │ │ │ │ │ ├── dist │ │ │ │ │ │ ├── js │ │ │ │ │ │ │ └── _script.js │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── _style.css │ │ │ │ │ │ └── img │ │ │ │ │ │ │ └── plugin.svg │ │ │ │ │ └── _PluginAssetBundle.php │ │ │ │ ├── fieldresources │ │ │ │ │ ├── dist │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── _field.css │ │ │ │ │ │ ├── js │ │ │ │ │ │ │ └── _field.js │ │ │ │ │ │ └── img │ │ │ │ │ │ │ └── field.svg │ │ │ │ │ └── _FieldAssetBundle.php │ │ │ │ ├── widgetresources │ │ │ │ │ ├── dist │ │ │ │ │ │ ├── js │ │ │ │ │ │ │ └── _widget.js │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── _widget.css │ │ │ │ │ │ └── img │ │ │ │ │ │ │ └── widget.svg │ │ │ │ │ └── _WidgetAssetBundle.php │ │ │ │ ├── utilityresources │ │ │ │ │ ├── dist │ │ │ │ │ │ ├── js │ │ │ │ │ │ │ └── _utility.js │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── _utility.css │ │ │ │ │ │ └── img │ │ │ │ │ │ │ └── utility.svg │ │ │ │ │ └── _UtilityAssetBundle.php │ │ │ │ └── cpsectionresources │ │ │ │ │ ├── dist │ │ │ │ │ ├── css │ │ │ │ │ │ └── _cpsection.css │ │ │ │ │ ├── js │ │ │ │ │ │ └── _cpsection.js │ │ │ │ │ └── img │ │ │ │ │ │ └── cpsection.svg │ │ │ │ │ └── _CPSectionAssetBundle.php │ │ │ ├── templates │ │ │ │ ├── _components │ │ │ │ │ ├── fields │ │ │ │ │ │ ├── _input.twig │ │ │ │ │ │ └── _settings.twig │ │ │ │ │ ├── widgets │ │ │ │ │ │ ├── _body.twig │ │ │ │ │ │ └── _settings.twig │ │ │ │ │ └── utilities │ │ │ │ │ │ └── _content.twig │ │ │ │ ├── _settings.twig │ │ │ │ └── _index.twig │ │ │ ├── _config.php │ │ │ ├── translations │ │ │ │ └── _en.php │ │ │ ├── icon.svg │ │ │ ├── icon-mask.svg │ │ │ ├── variables │ │ │ │ └── _Variable.php │ │ │ ├── services │ │ │ │ └── _Service.php │ │ │ ├── models │ │ │ │ ├── _Model.php │ │ │ │ └── _Settings.php │ │ │ ├── records │ │ │ │ └── _Record.php │ │ │ ├── twigextensions │ │ │ │ └── _TwigExtension.php │ │ │ ├── controllers │ │ │ │ └── _Controller.php │ │ │ ├── jobs │ │ │ │ └── _Job.php │ │ │ ├── console │ │ │ │ └── controllers │ │ │ │ │ └── _Command.php │ │ │ └── utilities │ │ │ │ └── _Utility.php │ │ ├── _CHANGELOG.md │ │ ├── _gitignore │ │ ├── _LICENSE.md │ │ ├── _README.md │ │ ├── _codeception.yml │ │ └── _composer.json │ ├── api_version_2_5 │ │ ├── resources │ │ │ ├── images │ │ │ │ └── plugin.png │ │ │ ├── screenshots │ │ │ │ └── plugin_logo.png │ │ │ ├── css │ │ │ │ ├── _style.css │ │ │ │ ├── fields │ │ │ │ │ └── _field.css │ │ │ │ └── widgets │ │ │ │ │ └── _widget.css │ │ │ ├── js │ │ │ │ ├── _script.js │ │ │ │ ├── widgets │ │ │ │ │ └── _widget.js │ │ │ │ └── fields │ │ │ │ │ └── _field.js │ │ │ ├── icon.svg │ │ │ └── icon-mask.svg │ │ ├── _CHANGELOG.md │ │ ├── _releases.json │ │ ├── _composer.json │ │ ├── templates │ │ │ ├── widgets │ │ │ │ ├── _body.twig │ │ │ │ └── _settings.twig │ │ │ ├── fields │ │ │ │ └── _field.twig │ │ │ └── _settings.twig │ │ ├── translations │ │ │ └── _en.php │ │ ├── _LICENSE.txt │ │ ├── models │ │ │ ├── _Model.php │ │ │ ├── _FieldModel.php │ │ │ └── _ElementModel.php │ │ ├── _README.md │ │ ├── services │ │ │ └── _Service.php │ │ ├── variables │ │ │ └── _Variable.php │ │ ├── consolecommands │ │ │ └── _Command.php │ │ ├── controllers │ │ │ └── _Controller.php │ │ ├── tasks │ │ │ └── _Task.php │ │ ├── twigextensions │ │ │ └── _TwigExtension.php │ │ ├── records │ │ │ ├── _Record.php │ │ │ ├── _ElementRecord.php │ │ │ └── _PurchasableRecord.php │ │ ├── widgets │ │ │ └── _Widget.php │ │ ├── fieldtypes │ │ │ └── _FieldType.php │ │ └── elementtypes │ │ │ └── _ElementType.php │ └── module_api_version_3_0 │ │ ├── resources │ │ └── img │ │ │ └── plugin-logo.png │ │ ├── src │ │ ├── assetbundles │ │ │ ├── moduleresources │ │ │ │ ├── dist │ │ │ │ │ ├── css │ │ │ │ │ │ └── _style.css │ │ │ │ │ ├── js │ │ │ │ │ │ └── _script.js │ │ │ │ │ └── img │ │ │ │ │ │ └── plugin.svg │ │ │ │ └── _ModuleAssetBundle.php │ │ │ ├── fieldresources │ │ │ │ ├── dist │ │ │ │ │ ├── css │ │ │ │ │ │ └── _field.css │ │ │ │ │ ├── js │ │ │ │ │ │ └── _field.js │ │ │ │ │ └── img │ │ │ │ │ │ └── field.svg │ │ │ │ └── _FieldAssetBundle.php │ │ │ ├── utilityresources │ │ │ │ ├── dist │ │ │ │ │ ├── js │ │ │ │ │ │ └── _utility.js │ │ │ │ │ ├── css │ │ │ │ │ │ └── _utility.css │ │ │ │ │ └── img │ │ │ │ │ │ └── utility.svg │ │ │ │ └── _UtilityAssetBundle.php │ │ │ └── widgetresources │ │ │ │ ├── dist │ │ │ │ ├── css │ │ │ │ │ └── _widget.css │ │ │ │ ├── js │ │ │ │ │ └── _widget.js │ │ │ │ └── img │ │ │ │ │ └── widget.svg │ │ │ │ └── _WidgetAssetBundle.php │ │ ├── templates │ │ │ └── _components │ │ │ │ ├── fields │ │ │ │ ├── _input.twig │ │ │ │ └── _settings.twig │ │ │ │ ├── widgets │ │ │ │ ├── _body.twig │ │ │ │ └── _settings.twig │ │ │ │ └── utilities │ │ │ │ └── _content.twig │ │ ├── translations │ │ │ └── _en.php │ │ ├── services │ │ │ └── _Service.php │ │ ├── variables │ │ │ └── _Variable.php │ │ ├── models │ │ │ └── _Model.php │ │ ├── records │ │ │ └── _Record.php │ │ ├── twigextensions │ │ │ └── _TwigExtension.php │ │ ├── controllers │ │ │ └── _Controller.php │ │ ├── jobs │ │ │ └── _Job.php │ │ ├── console │ │ │ └── controllers │ │ │ │ └── _Command.php │ │ └── utilities │ │ │ └── _Utility.php │ │ ├── _CHANGELOG.md │ │ ├── _gitignore │ │ ├── _LICENSE.md │ │ ├── _App.php │ │ └── _README.md └── php-reserved-words.js ├── package.json ├── .gitignore └── LICENSE.md /app/templates/api_version_3_0/tests/.gitignore: -------------------------------------------------------------------------------- 1 | *.env 2 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_craft/storage/example-file.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/unit/_bootstrap.php: -------------------------------------------------------------------------------- 1 | true, 5 | ]; 6 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_craft/templates/example.twig: -------------------------------------------------------------------------------- 1 | Im a twig template and here's a random number {{ random() }} 2 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_craft/config/test.php: -------------------------------------------------------------------------------- 1 | Changelog 2 | 3 | ## <%= pluginVersion %> -- <%= niceDate %> 4 | 5 | * Initial release 6 | 7 | Brought to you by [<%= pluginAuthorName %>](<%= pluginAuthorUrl %>) 8 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/_releases.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "version": "<%= pluginVersion %>", 4 | "downloadUrl": "<%= pluginDownloadUrl %>", 5 | "date": "<%= dateNow %>", 6 | "notes": [ 7 | "[Added] Initial release" 8 | ] 9 | } 10 | ] -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/example-env: -------------------------------------------------------------------------------- 1 | # Set in accordance to your environment 2 | 3 | DB_DRIVER="mysql" 4 | DB_SERVER="localhost" 5 | DB_USER="root" 6 | DB_PASSWORD="" 7 | DB_DATABASE="craft-test" 8 | DB_SCHEMA="" 9 | DB_TABLE_PREFIX="craft" 10 | DB_PORT="3306" 11 | SECURITY_KEY="abcde12345" 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/css/_style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginName %> CSS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/js/_script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginName %> JS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/_composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= pluginAuthorGithub %>/<%= pluginDirName %>", 3 | "description": "<%= pluginDescription %>", 4 | "type": "craft-plugin", 5 | "authors": [ 6 | { 7 | "name": "<%= pluginAuthorName %>", 8 | "homepage": "<%= pluginAuthorUrl %>" 9 | } 10 | ], 11 | "require": { 12 | "craftcms/cms": "^3.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/pluginresources/dist/js/_script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%- pluginName %> JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # <%- pluginName %> Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## <%= pluginVersion %> - <%= niceDate %> 8 | ### Added 9 | - Initial release 10 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/pluginresources/dist/css/_style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%- pluginName %> CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/js/widgets/_widget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginName %><%= widgetName[index] %>Widget JS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/moduleresources/dist/css/_style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%- pluginName %> CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/moduleresources/dist/js/_script.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%- pluginName %> JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/css/fields/_field.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginHandle %><%= fieldName[index] %>FieldType CSS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/css/widgets/_widget.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginName %><%= widgetName[index] %>Widget CSS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/fieldresources/dist/css/_field.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= fieldName[index] %> Field CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/widgetresources/dist/js/_widget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= widgetName[index] %> Widget JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/_CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # <%- pluginName %> Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## <%= pluginVersion %> - <%= niceDate %> 8 | ### Added 9 | - Initial release 10 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/utilityresources/dist/js/_utility.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= utilityName[index] %> Utility JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/widgetresources/dist/css/_widget.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= widgetName[index] %> Widget CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/fieldresources/dist/css/_field.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= fieldName[index] %> Field CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/templates/widgets/_body.twig: -------------------------------------------------------------------------------- 1 | {# 2 | /** 3 | * <%= pluginName %> plugin for Craft CMS 4 | * 5 | * <%= pluginName %><%= widgetName[index] %>Widget Body 6 | * 7 | * @author <%= pluginAuthorName %> 8 | * @copyright <%= copyrightNotice %> 9 | * @link <%= pluginAuthorUrl %> 10 | * @package <%= pluginHandle %> 11 | * @since <%= pluginVersion %> 12 | */ 13 | #} 14 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/cpsectionresources/dist/css/_cpsection.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= cpsectionName[index] %> Field CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/cpsectionresources/dist/js/_cpsection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= cpsectionName[index] %> Field JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/utilityresources/dist/css/_utility.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= utilityName[index] %> Utility CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/utilityresources/dist/js/_utility.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= utilityName[index] %> Utility JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/widgetresources/dist/css/_widget.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= widgetName[index] %> Widget CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/widgetresources/dist/js/_widget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= widgetName[index] %> Widget JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/utilityresources/dist/css/_utility.css: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= utilityName[index] %> Utility CSS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_craft/config/db.php: -------------------------------------------------------------------------------- 1 | getenv('DB_PASSWORD'), 5 | 'user' => getenv('DB_USER'), 6 | 'database' => getenv('DB_DATABASE'), 7 | 'tablePrefix' => getenv('DB_TABLE_PREFIX'), 8 | 'driver' => getenv('DB_DRIVER'), 9 | 'port' => getenv('DB_PORT'), 10 | 'schema' => getenv('DB_SCHEMA'), 11 | 'server' => getenv('DB_SERVER'), 12 | ]; 13 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/translations/_en.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginName %> Translation 6 | * 7 | * @author <%= pluginAuthorName %> 8 | * @copyright <%= copyrightNotice %> 9 | * @link <%= pluginAuthorUrl %> 10 | * @package <%= pluginHandle %> 11 | * @since <%= pluginVersion %> 12 | */ 13 | 14 | return array( 15 | 'Translate me' => 'To this', 16 | ); 17 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_support/Helper/Unit.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace Helper; 12 | 13 | use Codeception\Module; 14 | 15 | /** 16 | * Class Unit 17 | * 18 | * Here you can define custom actions. 19 | * All public methods declared in helper class will be available in $I 20 | * 21 | */ 22 | class Unit extends Module 23 | { 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_support/Helper/Functional.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace Helper; 12 | 13 | use Codeception\Module; 14 | 15 | /** 16 | * Class Functional 17 | * 18 | * Here you can define custom actions. 19 | * All public methods declared in helper class will be available in $I 20 | */ 21 | class Functional extends Module 22 | { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_gitignore: -------------------------------------------------------------------------------- 1 | # CRAFT ENVIRONMENT 2 | .env.php 3 | .env.sh 4 | .env 5 | 6 | # COMPOSER 7 | /vendor 8 | 9 | # BUILD FILES 10 | /bower_components/* 11 | /node_modules/* 12 | /build/* 13 | /yarn-error.log 14 | 15 | # MISC FILES 16 | .cache 17 | .DS_Store 18 | .idea 19 | .project 20 | .settings 21 | *.esproj 22 | *.sublime-workspace 23 | *.sublime-project 24 | *.tmproj 25 | *.tmproject 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | config.codekit3 32 | prepros-6.config 33 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/_gitignore: -------------------------------------------------------------------------------- 1 | # CRAFT ENVIRONMENT 2 | .env.php 3 | .env.sh 4 | .env 5 | 6 | # COMPOSER 7 | /vendor 8 | 9 | # BUILD FILES 10 | /bower_components/* 11 | /node_modules/* 12 | /build/* 13 | /yarn-error.log 14 | 15 | # MISC FILES 16 | .cache 17 | .DS_Store 18 | .idea 19 | .project 20 | .settings 21 | *.esproj 22 | *.sublime-workspace 23 | *.sublime-project 24 | *.tmproj 25 | *.tmproject 26 | .vscode/* 27 | !.vscode/settings.json 28 | !.vscode/tasks.json 29 | !.vscode/launch.json 30 | !.vscode/extensions.json 31 | config.codekit3 32 | prepros-6.config 33 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_bootstrap.php: -------------------------------------------------------------------------------- 1 | \<%= pluginDirName %>tests\acceptance; 4 | 5 | use Craft; 6 | use FunctionalTester; 7 | 8 | class ExampleFunctionalCest 9 | { 10 | // Public methods 11 | // ========================================================================= 12 | 13 | // Tests 14 | // ========================================================================= 15 | 16 | /** 17 | * 18 | */ 19 | public function testCraftEdition(FunctionalTester $I) 20 | { 21 | $I->amOnPage('?p=/'); 22 | $I->seeResponseCodeIs(200); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/templates/fields/_field.twig: -------------------------------------------------------------------------------- 1 | {# 2 | /** 3 | * <%= pluginName %> plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= fieldName[index] %>FieldType HTML 6 | * 7 | * @author <%= pluginAuthorName %> 8 | * @copyright <%= copyrightNotice %> 9 | * @link <%= pluginAuthorUrl %> 10 | * @package <%= pluginHandle %> 11 | * @since <%= pluginVersion %> 12 | */ 13 | #} 14 | 15 | {% import "_includes/forms" as forms %} 16 | 17 | {{ forms.textField({ 18 | id: id ~ 'someField', 19 | class: 'nicetext', 20 | name: name ~ '[someField]', 21 | value: values.someField, 22 | errors: values.getErrors('someField'), 23 | required: false, 24 | }) }} 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-craftplugin", 3 | "version": "1.6.0", 4 | "description": "generator-craftplugin is a Yeoman generator for Craft CMS plugins", 5 | "main": "app/index.js", 6 | "files": [ 7 | "app" 8 | ], 9 | "repository": "nystudio107/generator-craftplugin", 10 | "keywords": [ 11 | "yeoman-generator", 12 | "generator-craftplugin", 13 | "craft-cms", 14 | "plugin", 15 | "craft" 16 | ], 17 | "author": "nystudio107", 18 | "license": "MIT", 19 | "dependencies": { 20 | "ncp": "^2.0.0", 21 | "chalk": "^1.1.1", 22 | "inflection": "^1.7.1", 23 | "yeoman-option-or-prompt": "^1.0.2", 24 | "yeoman-generator": "^0.20.3" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_components/fields/_input.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 3.x 5 | * 6 | * <%= fieldName[index] %> Field Input 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {{ forms.textField({ 19 | label: 'Some Field', 20 | instructions: 'Enter some text here.', 21 | id: name, 22 | name: name, 23 | value: value}) 24 | }} 25 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/templates/_components/fields/_input.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> module for Craft CMS 3.x 5 | * 6 | * <%= fieldName[index] %> Field Input 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {{ forms.textField({ 19 | label: 'Some Field', 20 | instructions: 'Enter some text here.', 21 | id: name, 22 | name: name, 23 | value: value}) 24 | }} 25 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/templates/_components/widgets/_body.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> module for Craft CMS 5 | * 6 | * <%= widgetName[index] %> Widget Body 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% set iconUrl = view.getAssetManager().getPublishedUrl('@modules/<%= pluginKebabHandle %>/assetbundles/<%= widgetName[index].toLowerCase() %>widget/dist', true) ~ '/img/<%= widgetName[index] %>-icon.svg' %} 17 | 18 | 19 | 20 |

{{ message }}

21 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_components/widgets/_body.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 5 | * 6 | * <%= widgetName[index] %> Widget Body 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% set iconUrl = view.getAssetManager().getPublishedUrl('@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= widgetName[index].toLowerCase() %>widget/dist', true) ~ '/img/<%= widgetName[index] %>-icon.svg' %} 17 | 18 | 19 | 20 |

{{ message }}

21 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/templates/_settings.twig: -------------------------------------------------------------------------------- 1 | {# 2 | /** 3 | * <%= pluginName %> plugin for Craft CMS 4 | * 5 | * <%= pluginName %> Settings.twig 6 | * 7 | * @author <%= pluginAuthorName %> 8 | * @copyright <%= copyrightNotice %> 9 | * @link <%= pluginAuthorUrl %> 10 | * @package <%= pluginHandle %> 11 | * @since <%= pluginVersion %> 12 | */ 13 | #} 14 | 15 | {% import "_includes/forms" as forms %} 16 | 17 | {% includeCssResource "<%= pluginDirName %>/css/<%= pluginHandle %>_Style.css" %} 18 | {% includeJsResource "<%= pluginDirName %>/js/<%= pluginHandle %>_Script.js" %} 19 | 20 | {{ forms.textField({ 21 | label: 'Some Setting', 22 | instructions: 'Enter some setting here.', 23 | id: 'someSetting', 24 | name: 'someSetting', 25 | value: settings['someSetting']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/templates/widgets/_settings.twig: -------------------------------------------------------------------------------- 1 | {# 2 | /** 3 | * <%= pluginName %> plugin for Craft CMS 4 | * 5 | * <%= pluginName %><%= widgetName[index] %>Widget Settings 6 | * 7 | * @author <%= pluginAuthorName %> 8 | * @copyright <%= copyrightNotice %> 9 | * @link <%= pluginAuthorUrl %> 10 | * @package <%= pluginHandle %> 11 | * @since <%= pluginVersion %> 12 | */ 13 | #} 14 | 15 | {% import "_includes/forms" as forms %} 16 | 17 | {% includeCssResource "<%= pluginDirName %>/css/<%= pluginHandle %>_Style.css" %} 18 | {% includeJsResource "<%= pluginDirName %>/js/<%= pluginHandle %>_Script.js" %} 19 | 20 | {{ forms.textField({ 21 | label: 'Some Setting', 22 | instructions: 'Enter some setting here.', 23 | id: 'someSetting', 24 | name: 'someSetting', 25 | value: settings['someSetting']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/templates/_components/widgets/_settings.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> module for Craft CMS 5 | * 6 | * <%= widgetName[index] %> Widget Settings 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {% do view.registerAssetBundle("modules\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 19 | 20 | {{ forms.textField({ 21 | label: 'Message', 22 | instructions: 'Enter a message here.', 23 | id: 'message', 24 | name: 'message', 25 | value: widget['message']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_components/widgets/_settings.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 5 | * 6 | * <%= widgetName[index] %> Widget Settings 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {% do view.registerAssetBundle("<%= pluginVendorName %>\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 19 | 20 | {{ forms.textField({ 21 | label: 'Message', 22 | instructions: 'Enter a message here.', 23 | id: 'message', 24 | name: 'message', 25 | value: widget['message']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_settings.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 3.x 5 | * 6 | * <%- pluginName %> Settings.twig 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {% do view.registerAssetBundle("<%= pluginVendorName %>\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 19 | 20 | {{ forms.textField({ 21 | label: 'Some Field', 22 | instructions: 'Enter some setting here.', 23 | id: 'someAttribute', 24 | name: 'someAttribute', 25 | value: settings['someAttribute']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/templates/_components/utilities/_content.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> module for Craft CMS 5 | * 6 | * <%= utilityName[index] %> Utility Content 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 |

<%= utilityName[index] %>

17 | 18 | {% set iconUrl = view.getAssetManager().getPublishedUrl('@modules/<%= pluginKebabHandle %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist', true) ~ '/img/<%= utilityName[index] %>-icon.svg' %} 19 | 20 | 21 | 22 |

Your Utility content goes here

23 | 24 |

{{ someVar }}

-------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_components/utilities/_content.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 5 | * 6 | * <%= utilityName[index] %> Utility Content 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 |

<%= utilityName[index] %>

17 | 18 | {% set iconUrl = view.getAssetManager().getPublishedUrl('@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist', true) ~ '/img/<%= utilityName[index] %>-icon.svg' %} 19 | 20 | 21 | 22 |

Your Utility content goes here

23 | 24 |

{{ someVar }}

-------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/templates/_components/fields/_settings.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> module for Craft CMS 5 | * 6 | * <%= fieldName[index] %> Field Settings 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {% do view.registerAssetBundle("modules\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 19 | 20 | {{ forms.textField({ 21 | label: 'Some Attribute', 22 | instructions: 'Enter some attribute here.', 23 | id: 'someAttribute', 24 | name: 'someAttribute', 25 | value: field['someAttribute']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_components/fields/_settings.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 5 | * 6 | * <%= fieldName[index] %> Field Settings 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | 16 | {% import "_includes/forms" as forms %} 17 | 18 | {% do view.registerAssetBundle("<%= pluginVendorName %>\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 19 | 20 | {{ forms.textField({ 21 | label: 'Some Attribute', 22 | instructions: 'Enter some attribute here.', 23 | id: 'someAttribute', 24 | name: 'someAttribute', 25 | value: field['someAttribute']}) 26 | }} 27 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/_config.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | /** 12 | * <%- pluginName %> config.php 13 | * 14 | * This file exists only as a template for the <%- pluginName %> settings. 15 | * It does nothing on its own. 16 | * 17 | * Don't edit this file, instead copy it to 'craft/config' as '<%= pluginKebabHandle %>.php' 18 | * and make your changes there to override default settings. 19 | * 20 | * Once copied to 'craft/config', this file will be multi-environment aware as 21 | * well, so you can have different settings groups for each environment, just as 22 | * you do for 'general.php' 23 | */ 24 | 25 | return [ 26 | 27 | // This controls blah blah blah 28 | "someAttribute" => true, 29 | 30 | ]; 31 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_support/UnitTester.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | use Codeception\Actor; 12 | use Codeception\Lib\Friend; 13 | 14 | /** 15 | * Inherited Methods 16 | * 17 | * @method void wantToTest($text) 18 | * @method void wantTo($text) 19 | * @method void execute($callable) 20 | * @method void expectTo($prediction) 21 | * @method void expect($prediction) 22 | * @method void amGoingTo($argumentation) 23 | * @method void am($role) 24 | * @method void lookForwardTo($achieveValue) 25 | * @method void comment($description) 26 | * @method Friend haveFriend($name, $actorClass = null) 27 | * 28 | * @SuppressWarnings(PHPMD) 29 | * 30 | */ 31 | class UnitTester extends Actor 32 | { 33 | use _generated\UnitTesterActions; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/_support/FunctionalTester.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | use Codeception\Actor; 12 | use Codeception\Lib\Friend; 13 | 14 | /** 15 | * Inherited Methods 16 | * 17 | * @method void wantToTest($text) 18 | * @method void wantTo($text) 19 | * @method void execute($callable) 20 | * @method void expectTo($prediction) 21 | * @method void expect($prediction) 22 | * @method void amGoingTo($argumentation) 23 | * @method void am($role) 24 | * @method void lookForwardTo($achieveValue) 25 | * @method void comment($description) 26 | * @method Friend haveFriend($name, $actorClass = null) 27 | * 28 | * @SuppressWarnings(PHPMD) 29 | * 30 | */ 31 | class FunctionalTester extends Actor 32 | { 33 | use _generated\FunctionalTesterActions; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # LOCAL CONFIG SETTINGS 2 | # Exclude local config files so we don't overwrite other local setups. 3 | # Leave example files that can be copied to get setup 4 | # ------------------------------------------------------------ 5 | /craft/config/local/* 6 | !/craft/config/local/db.php.example 7 | !/craft/config/local/general.php.example 8 | 9 | # CRAFT STORAGE 10 | # http://buildwithcraft.com/help/craft-storage-gitignore 11 | # ------------------------------------------------------------ 12 | /craft/storage/* 13 | !/craft/storage/.gitignore 14 | !/craft/storage/logo/* 15 | 16 | # MISC FILES 17 | # https://github.com/github/gitignore/tree/master/Global 18 | # ------------------------------------------------------------ 19 | .cache 20 | .DS_Store 21 | .idea 22 | .project 23 | .settings 24 | *.esproj 25 | *.sublime-workspace 26 | *.sublime-project 27 | *.tmproj 28 | *.tmproject 29 | Thumbs.db 30 | /logs/* 31 | 32 | # BUILD FILES 33 | # aaw -- 2015-09-27 34 | /bower_components/* 35 | /node_modules/* 36 | /build/* 37 | npm-debug.log -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/translations/_en.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 12 | /** 13 | * <%- pluginName %> en Translation 14 | * 15 | * Returns an array with the string to be translated (as passed to `Craft::t('<%= pluginKebabHandle %>', '...')`) as 16 | * the key, and the translation as the value. 17 | * 18 | * http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html 19 | * 20 | * @author <%- pluginAuthorName %> 21 | * @package <%= pluginHandle %> 22 | * @since <%= pluginVersion %> 23 | */ 24 | <% } else { -%> 25 | /** 26 | * @author <%- pluginAuthorName %> 27 | * @package <%= pluginHandle %> 28 | * @since <%= pluginVersion %> 29 | */ 30 | <% } -%> 31 | return [ 32 | '<%- pluginName %> plugin loaded' => '<%- pluginName %> plugin loaded', 33 | ]; 34 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/translations/_en.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 12 | /** 13 | * <%- pluginName %> en Translation 14 | * 15 | * Returns an array with the string to be translated (as passed to `Craft::t('<%= pluginKebabHandle %>', '...')`) as 16 | * the key, and the translation as the value. 17 | * 18 | * http://www.yiiframework.com/doc-2.0/guide-tutorial-i18n.html 19 | * 20 | * @author <%- pluginAuthorName %> 21 | * @package <%= pluginHandle %> 22 | * @since <%= pluginVersion %> 23 | */ 24 | <% } else { -%> 25 | /** 26 | * @author <%- pluginAuthorName %> 27 | * @package <%= pluginHandle %> 28 | * @since <%= pluginVersion %> 29 | */ 30 | <% } -%> 31 | return [ 32 | '<%- pluginName %> plugin loaded' => '<%- pluginName %> plugin loaded', 33 | ]; 34 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 nystudio107 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/templates/api_version_2_5/_LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | <%= copyrightNotice %> 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | <%- copyrightNotice %> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_README.md: -------------------------------------------------------------------------------- 1 | # <%- pluginName %> plugin for Craft CMS 3.x 2 | 3 | <%- pluginDescription %> 4 | 5 | ![Screenshot](resources/img/plugin-logo.png) 6 | 7 | ## Requirements 8 | 9 | This plugin requires Craft CMS 3.0.0-beta.23 or later. 10 | 11 | ## Installation 12 | 13 | To install the plugin, follow these instructions. 14 | 15 | 1. Open your terminal and go to your Craft project: 16 | 17 | cd /path/to/project 18 | 19 | 2. Then tell Composer to load the plugin: 20 | 21 | composer require <%= pluginAuthorGithub %>/<%= pluginKebabHandle %> 22 | 23 | 3. In the Control Panel, go to Settings → Plugins and click the “Install” button for <%- pluginName %>. 24 | 25 | ## <%- pluginName %> Overview 26 | 27 | -Insert text here- 28 | 29 | ## Configuring <%- pluginName %> 30 | 31 | -Insert text here- 32 | 33 | ## Using <%- pluginName %> 34 | 35 | -Insert text here- 36 | 37 | ## <%- pluginName %> Roadmap 38 | 39 | Some things to do, and ideas for potential features: 40 | 41 | * Release it 42 | 43 | Brought to you by [<%- pluginAuthorName %>](<%= pluginAuthorUrl %>) 44 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_codeception.yml: -------------------------------------------------------------------------------- 1 | actor: Tester 2 | paths: 3 | tests: tests 4 | log: tests/_output 5 | data: tests/_data 6 | support: tests/_support 7 | envs: tests/_envs 8 | settings: 9 | bootstrap: _bootstrap.php 10 | coverage: 11 | enabled: true 12 | include: 13 | - src/* 14 | exclude: 15 | - src/etc/* 16 | - src/migrations/* 17 | - src/templates/* 18 | - src/translations/* 19 | - src/web/assets/* 20 | - docs/* 21 | - templates/* 22 | - tests/* 23 | - vendor/* 24 | params: 25 | - tests/.env 26 | modules: 27 | config: 28 | \craft\test\Craft: 29 | configFile: 'tests/_craft/config/test.php' 30 | entryUrl: 'https://test.craftcms.test/index.php' 31 | projectConfig: {} 32 | migrations: [] 33 | plugins: 34 | <%= pluginKebabHandle %>: 35 | class: '\<%= pluginVendorName %>\<%= pluginDirName %>\<%= pluginHandle %>' 36 | handle: <%= pluginKebabHandle %> 37 | cleanup: true 38 | transaction: true 39 | dbSetup: {clean: true, setupCraft: true} 40 | fullMock: false 41 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/_LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | <%- copyrightNotice %> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /app/templates/api_version_2_5/models/_Model.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= modelName[index] %> Model 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Models are containers for data. Just about every time information is passed between services, controllers, and 10 | * templates in Craft, it’s passed via a model. 11 | * 12 | * https://craftcms.com/docs/plugins/models 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | class <%= pluginHandle %><%= modelName[index] %>Model extends BaseModel 26 | { 27 | /** 28 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 29 | * Defines this model's attributes. 30 | * 31 | <% } -%> 32 | * @return array 33 | */ 34 | protected function defineAttributes() 35 | { 36 | return array_merge(parent::defineAttributes(), array( 37 | 'someField' => array(AttributeType::String, 'default' => 'some value'), 38 | )); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/models/_FieldModel.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= fieldName[index] %> Model 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Models are containers for data. Just about every time information is passed between services, controllers, and 10 | * templates in Craft, it’s passed via a model. 11 | * 12 | * https://craftcms.com/docs/plugins/models 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | class <%= pluginHandle %><%= fieldName[index] %>Model extends BaseModel 26 | { 27 | /** 28 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 29 | * Defines this model's attributes. 30 | * 31 | <% } -%> 32 | * @return array 33 | */ 34 | protected function defineAttributes() 35 | { 36 | return array_merge(parent::defineAttributes(), array( 37 | 'someField' => array(AttributeType::String, 'default' => 'some value'), 38 | )); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/_App.php: -------------------------------------------------------------------------------- 1 | [ 17 | '<%= pluginKebabHandle %>' => [ 18 | 'class' => \modules\<%= pluginDirName %>\<%= pluginHandle %>::class, 19 | <% if (pluginComponents.indexOf('services') >= 0){ -%> 20 | <% var components = serviceName -%> 21 | <% if ((typeof(components[0]) !== 'undefined') && (components[0] !== "")) { -%> 22 | 'components' => [ 23 | <% components.forEach(function(component, index, array){ -%> 24 | '<%= component[0].toLowerCase() + component.slice(1) %>' => [ 25 | 'class' => 'modules\<%= pluginDirName %>\services\<%= component%>', 26 | ], 27 | <% }); -%> 28 | ], 29 | <% } -%> 30 | <% } -%> 31 | ], 32 | ], 33 | 'bootstrap' => ['<%= pluginKebabHandle %>'], 34 | ]; 35 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/_README.md: -------------------------------------------------------------------------------- 1 | # <%= pluginName %> plugin for Craft CMS 2 | 3 | <%= pluginDescription %> 4 | 5 | ![Screenshot](resources/screenshots/plugin_logo.png) 6 | 7 | ## Installation 8 | 9 | To install <%= pluginName %>, follow these steps: 10 | 11 | 1. Download & unzip the file and place the `<%= pluginDirName %>` directory into your `craft/plugins` directory 12 | 2. -OR- do a `git clone <%= pluginCloneUrl %>` directly into your `craft/plugins` folder. You can then update it with `git pull` 13 | 3. -OR- install with Composer via `composer require <%= pluginAuthorGithub %>/<%= pluginDirName %>` 14 | 4. Install plugin in the Craft Control Panel under Settings > Plugins 15 | 5. The plugin folder should be named `<%= pluginDirName %>` for Craft to see it. GitHub recently started appending `-master` (the branch name) to the name of the folder for zip file downloads. 16 | 17 | <%= pluginName %> works on Craft 2.4.x and Craft 2.5.x. 18 | 19 | ## <%= pluginName %> Overview 20 | 21 | -Insert text here- 22 | 23 | ## Configuring <%= pluginName %> 24 | 25 | -Insert text here- 26 | 27 | ## Using <%= pluginName %> 28 | 29 | -Insert text here- 30 | 31 | ## <%= pluginName %> Roadmap 32 | 33 | Some things to do, and ideas for potential features: 34 | 35 | * Release it 36 | 37 | Brought to you by [<%= pluginAuthorName %>](<%= pluginAuthorUrl %>) 38 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/services/_Service.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= serviceName[index] %> Service 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * All of your plugin’s business logic should go in services, including saving data, retrieving data, etc. They 10 | * provide APIs that your controllers, template variables, and other plugins can interact with. 11 | * 12 | * https://craftcms.com/docs/plugins/services 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | class <%= pluginHandle %><%= serviceName[index] %>Service extends BaseApplicationComponent 26 | { 27 | /** 28 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 29 | * This function can literally be anything you want, and you can have as many service functions as you want 30 | * 31 | * From any other plugin file, call it like this: 32 | * 33 | * craft()-><%= pluginCamelHandle %><%= serviceName[index] ? "_" + serviceName[index][1].toLowerCase() + serviceName[index].slice(2) : "" %>->exampleService() 34 | <% } -%> 35 | */ 36 | public function exampleService() 37 | { 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/variables/_Variable.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginName %> Variable 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Craft allows plugins to provide their own template variables, accessible from the {{ craft }} global variable 10 | * (e.g. {{ craft.pluginName }}). 11 | * 12 | * https://craftcms.com/docs/plugins/variables 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | class <%= pluginHandle %>Variable 26 | { 27 | /** 28 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 29 | * Whatever you want to output to a Twig template can go into a Variable method. You can have as many variable 30 | * functions as you want. From any Twig template, call it like this: 31 | * 32 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable }} 33 | * 34 | * Or, if your variable requires input from Twig: 35 | * 36 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable(twigValue) }} 37 | <% } -%> 38 | */ 39 | public function exampleVariable($optional = null) 40 | { 41 | return "And away we go to the Twig template..."; 42 | } 43 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/consolecommands/_Command.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %> Command 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Craft is built on the Yii framework and includes a command runner, yiic in ./craft/app/etc/console/yiic 10 | * 11 | * Action methods are mapped to command-line commands, and begin with the prefix “action”, followed by 12 | * a description of what the method does (for example, actionPrint(). The actionIndex() method is what 13 | * is executed if no sub-commands are supplied, e.g.: 14 | * 15 | * ./craft/app/etc/console/yiic <%= pluginDirName %> 16 | * 17 | * The actionPrint() method above would be invoked via: 18 | * 19 | * ./craft/app/etc/console/yiic <%= pluginDirName %> print 20 | * 21 | * http://spin.atomicobject.com/2015/06/16/craft-console-plugin/ 22 | * --snip-- 23 | * 24 | <% } -%> 25 | * @author <%= pluginAuthorName %> 26 | * @copyright <%= copyrightNotice %> 27 | * @link <%= pluginAuthorUrl %> 28 | * @package <%= pluginHandle %> 29 | * @since <%= pluginVersion %> 30 | */ 31 | 32 | namespace Craft; 33 | 34 | class <%= pluginHandle %>Command extends BaseCommand 35 | { 36 | /** 37 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 38 | * Handle our plugin's index action command, e.g.: ./craft/app/etc/console/yiic <%= pluginDirName %> 39 | <% } -%> 40 | */ 41 | public function actionIndex($param="") 42 | { 43 | } 44 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/js/fields/_field.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%= pluginName %> plugin for Craft CMS 3 | * 4 | * <%= pluginHandle %><%= fieldName[index] %>FieldType JS 5 | * 6 | * @author <%= pluginAuthorName %> 7 | * @copyright <%= copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %> 11 | */ 12 | 13 | ;(function ( $, window, document, undefined ) { 14 | 15 | var pluginName = "<%= pluginHandle %><%= fieldName %>FieldType", 16 | defaults = { 17 | }; 18 | 19 | // Plugin constructor 20 | function Plugin( element, options ) { 21 | this.element = element; 22 | 23 | this.options = $.extend( {}, defaults, options) ; 24 | 25 | this._defaults = defaults; 26 | this._name = pluginName; 27 | 28 | this.init(); 29 | } 30 | 31 | Plugin.prototype = { 32 | 33 | init: function(id) { 34 | var _this = this; 35 | 36 | $(function () { 37 | 38 | /* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */ 39 | 40 | }); 41 | } 42 | }; 43 | 44 | // A really lightweight plugin wrapper around the constructor, 45 | // preventing against multiple instantiations 46 | $.fn[pluginName] = function ( options ) { 47 | return this.each(function () { 48 | if (!$.data(this, "plugin_" + pluginName)) { 49 | $.data(this, "plugin_" + pluginName, 50 | new Plugin( this, options )); 51 | } 52 | }); 53 | }; 54 | 55 | })( jQuery, window, document ); 56 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/tests/unit/ExampleUnitTest.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>tests\unit; 12 | 13 | use Codeception\Test\Unit; 14 | use UnitTester; 15 | use Craft; 16 | use <%= pluginVendorName %>\<%= pluginDirName %>\<%= pluginHandle %>; 17 | 18 | /** 19 | * ExampleUnitTest 20 | * 21 | * 22 | * @author <%- pluginAuthorName %> 23 | * @package <%= pluginHandle %> 24 | * @since <%= pluginVersion %> 25 | */ 26 | class ExampleUnitTest extends Unit 27 | { 28 | // Properties 29 | // ========================================================================= 30 | 31 | /** 32 | * @var UnitTester 33 | */ 34 | protected $tester; 35 | 36 | // Public methods 37 | // ========================================================================= 38 | 39 | // Tests 40 | // ========================================================================= 41 | 42 | /** 43 | * 44 | */ 45 | public function testPluginInstance() 46 | { 47 | $this->assertInstanceOf( 48 | <%= pluginHandle %>::class, 49 | <%= pluginHandle %>::$plugin 50 | ); 51 | } 52 | 53 | /** 54 | * 55 | */ 56 | public function testCraftEdition() 57 | { 58 | Craft::$app->setEdition(Craft::Pro); 59 | 60 | $this->assertSame( 61 | Craft::Pro, 62 | Craft::$app->getEdition() 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/php-reserved-words.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Define an arry of reserved words in PHP 3 | * 4 | * @type {Array} 5 | */ 6 | module.exports = [ 7 | // Kewords: http://php.net/manual/en/reserved.keywords.php 8 | "__halt_compiler()", 9 | "abstract", 10 | "and", 11 | "array()", 12 | "as", 13 | "break", 14 | "callable", 15 | "case", 16 | "catch", 17 | "class", 18 | "clone", 19 | "const", 20 | "continue", 21 | "declare", 22 | "default", 23 | "die()", 24 | "do", 25 | "echo", 26 | "else", 27 | "elseif", 28 | "empty()", 29 | "enddeclare", 30 | "endfor", 31 | "endforeach", 32 | "endif", 33 | "endswitch", 34 | "endwhile", 35 | "eval()", 36 | "exit()", 37 | "extends", 38 | "final", 39 | "finally", 40 | "for", 41 | "foreach", 42 | "function", 43 | "global", 44 | "goto", 45 | "if", 46 | "implements", 47 | "include", 48 | "include_once", 49 | "instanceof", 50 | "insteadof", 51 | "interface", 52 | "isset()", 53 | "list()", 54 | "namespace", 55 | "new", 56 | "or", 57 | "print", 58 | "private", 59 | "protected", 60 | "public", 61 | "require", 62 | "require_once", 63 | "return", 64 | "static", 65 | "switch", 66 | "throw", 67 | "trait", 68 | "try", 69 | "unset()", 70 | "use", 71 | "var", 72 | "while", 73 | "xor", 74 | "yield", 75 | // Other: http://php.net/manual/en/reserved.other-reserved-words.php 76 | "int", 77 | "float", 78 | "bool", 79 | "string", 80 | "true", 81 | "false", 82 | "null", 83 | "void", 84 | "iterable", 85 | ]; -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/fieldresources/dist/js/_field.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> plugin for Craft CMS 3 | * 4 | * <%= fieldName[index] %> Field JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %><%= pluginHandle %><%= fieldName[index] %> 11 | */ 12 | 13 | ;(function ( $, window, document, undefined ) { 14 | 15 | var pluginName = "<%= pluginHandle %><%= fieldName[index] %>", 16 | defaults = { 17 | }; 18 | 19 | // Plugin constructor 20 | function Plugin( element, options ) { 21 | this.element = element; 22 | 23 | this.options = $.extend( {}, defaults, options) ; 24 | 25 | this._defaults = defaults; 26 | this._name = pluginName; 27 | 28 | this.init(); 29 | } 30 | 31 | Plugin.prototype = { 32 | 33 | init: function(id) { 34 | var _this = this; 35 | 36 | $(function () { 37 | 38 | /* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */ 39 | 40 | }); 41 | } 42 | }; 43 | 44 | // A really lightweight plugin wrapper around the constructor, 45 | // preventing against multiple instantiations 46 | $.fn[pluginName] = function ( options ) { 47 | return this.each(function () { 48 | if (!$.data(this, "plugin_" + pluginName)) { 49 | $.data(this, "plugin_" + pluginName, 50 | new Plugin( this, options )); 51 | } 52 | }); 53 | }; 54 | 55 | })( jQuery, window, document ); 56 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/fieldresources/dist/js/_field.js: -------------------------------------------------------------------------------- 1 | /** 2 | * <%- pluginName %> module for Craft CMS 3 | * 4 | * <%= fieldName[index] %> Field JS 5 | * 6 | * @author <%- pluginAuthorName %> 7 | * @copyright <%- copyrightNotice %> 8 | * @link <%= pluginAuthorUrl %> 9 | * @package <%= pluginHandle %> 10 | * @since <%= pluginVersion %><%= pluginHandle %><%= fieldName[index] %> 11 | */ 12 | 13 | ;(function ( $, window, document, undefined ) { 14 | 15 | var pluginName = "<%= pluginHandle %><%= fieldName[index] %>", 16 | defaults = { 17 | }; 18 | 19 | // Plugin constructor 20 | function Plugin( element, options ) { 21 | this.element = element; 22 | 23 | this.options = $.extend( {}, defaults, options) ; 24 | 25 | this._defaults = defaults; 26 | this._name = pluginName; 27 | 28 | this.init(); 29 | } 30 | 31 | Plugin.prototype = { 32 | 33 | init: function(id) { 34 | var _this = this; 35 | 36 | $(function () { 37 | 38 | /* -- _this.options gives us access to the $jsonVars that our FieldType passed down to us */ 39 | 40 | }); 41 | } 42 | }; 43 | 44 | // A really lightweight plugin wrapper around the constructor, 45 | // preventing against multiple instantiations 46 | $.fn[pluginName] = function ( options ) { 47 | return this.each(function () { 48 | if (!$.data(this, "plugin_" + pluginName)) { 49 | $.data(this, "plugin_" + pluginName, 50 | new Plugin( this, options )); 51 | } 52 | }); 53 | }; 54 | 55 | })( jQuery, window, document ); 56 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/utilityresources/dist/img/utility.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/utilityresources/dist/img/utility.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/controllers/_Controller.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= controllerName[index] %> Controller 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Generally speaking, controllers are the middlemen between the front end of the CP/website and your plugin’s 10 | * services. They contain action methods which handle individual tasks. 11 | * 12 | * A common pattern used throughout Craft involves a controller action gathering post data, saving it on a model, 13 | * passing the model off to a service, and then responding to the request appropriately depending on the service 14 | * method’s response. 15 | * 16 | * Action methods begin with the prefix “action”, followed by a description of what the method does (for example, 17 | * actionSaveIngredient()). 18 | * 19 | * https://craftcms.com/docs/plugins/controllers 20 | * --snip-- 21 | * 22 | <% } -%> 23 | * @author <%= pluginAuthorName %> 24 | * @copyright <%= copyrightNotice %> 25 | * @link <%= pluginAuthorUrl %> 26 | * @package <%= pluginHandle %> 27 | * @since <%= pluginVersion %> 28 | */ 29 | 30 | namespace Craft; 31 | 32 | class <%= pluginHandle %><%= controllerName[index] %>Controller extends BaseController 33 | { 34 | 35 | /** 36 | * @var bool|array Allows anonymous access to this controller's actions. 37 | * @access protected 38 | */ 39 | protected $allowAnonymous = array('actionIndex', 40 | ); 41 | 42 | /** 43 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 44 | * Handle a request going to our plugin's index action URL, e.g.: actions/<%= pluginCamelHandle %> 45 | <% } -%> 46 | */ 47 | public function actionIndex() 48 | { 49 | } 50 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/models/_ElementModel.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= elementName[index] %> Model 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Models are containers for data. Just about every time information is passed between services, controllers, and 10 | * templates in Craft, it’s passed via a model. 11 | * 12 | * https://craftcms.com/docs/plugins/models 13 | * 14 | * https://craftcms.com/docs/plugins/working-with-elements 15 | * --snip-- 16 | * 17 | <% } -%> 18 | * @author <%= pluginAuthorName %> 19 | * @copyright <%= copyrightNotice %> 20 | * @link <%= pluginAuthorUrl %> 21 | * @package <%= pluginHandle %> 22 | * @since <%= pluginVersion %> 23 | */ 24 | 25 | namespace Craft; 26 | 27 | class <%= pluginHandle %><%= elementName[index] %>Model extends BaseElementModel 28 | { 29 | /** 30 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 31 | * Defines this model's attributes. 32 | * 33 | <% } -%> 34 | * @return array 35 | */ 36 | protected function defineAttributes() 37 | { 38 | return array_merge(parent::defineAttributes(), array( 39 | 'someField' => array(AttributeType::String, 'default' => 'some value'), 40 | )); 41 | } 42 | 43 | /** 44 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 45 | * Returns whether the current user can edit the element. 46 | * 47 | <% } -%> 48 | * @return bool 49 | */ 50 | public function isEditable() 51 | { 52 | } 53 | 54 | /** 55 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 56 | * Returns the element's CP edit URL. 57 | * 58 | <% } -%> 59 | * @return string|false 60 | */ 61 | public function getCpEditUrl() 62 | { 63 | } 64 | } -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/services/_Service.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName%>\services; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\base\Component; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= serviceName[index] %> Service 21 | * 22 | * All of your module’s business logic should go in services, including saving data, 23 | * retrieving data, etc. They provide APIs that your controllers, template variables, 24 | * and other modules can interact with. 25 | * 26 | * https://craftcms.com/docs/plugins/services 27 | * 28 | * @author <%- pluginAuthorName %> 29 | * @package <%= pluginHandle %> 30 | * @since <%= pluginVersion %> 31 | */ 32 | <% } else { -%> 33 | /** 34 | * @author <%- pluginAuthorName %> 35 | * @package <%= pluginHandle %> 36 | * @since <%= pluginVersion %> 37 | */ 38 | <% } -%> 39 | class <%= serviceName[index] %> extends Component 40 | { 41 | // Public Methods 42 | // ========================================================================= 43 | 44 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 45 | /** 46 | * This function can literally be anything you want, and you can have as many service 47 | * functions as you want 48 | * 49 | * From any other plugin/module file, call it like this: 50 | * 51 | * <%= pluginHandle %>::$instance-><%= serviceName[index][0].toLowerCase() + serviceName[index].slice(1) %>->exampleService() 52 | * 53 | * @return mixed 54 | */ 55 | <% } else { -%> 56 | /* 57 | * @return mixed 58 | */ 59 | <% } -%> 60 | public function exampleService() 61 | { 62 | $result = 'something'; 63 | 64 | return $result; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/fieldresources/dist/img/field.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/fieldresources/dist/img/field.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/icon-mask.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/resources/icon-mask.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/pluginresources/dist/img/plugin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/moduleresources/dist/img/plugin.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/_composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= pluginVendorName %>/<%= pluginKebabHandle %>", 3 | "description": "<%- pluginDescription %>", 4 | "type": "craft-plugin", 5 | "version": "<%= pluginVersion %>", 6 | "keywords": [ 7 | "craft", 8 | "cms", 9 | "craftcms", 10 | "craft-plugin", 11 | "<%= pluginName.toLowerCase() %>" 12 | ], 13 | "support": { 14 | "docs": "<%= pluginDocsUrl %>", 15 | "issues": "<%= pluginIssuesUrl %>" 16 | }, 17 | "license": "MIT", 18 | "authors": [ 19 | { 20 | "name": "<%- pluginAuthorName %>", 21 | "homepage": "<%= pluginAuthorUrl %>" 22 | } 23 | ], 24 | "require": { 25 | "craftcms/cms": "^3.0.0" 26 | }, 27 | <% if (pluginComponents.indexOf('tests') >= 0){ -%> 28 | "require-dev": { 29 | "craftcms/cms": "^3.2.0", 30 | "codeception/codeception": "^3.0", 31 | "vlucas/phpdotenv": "^3.0" 32 | }, 33 | <% } -%> 34 | "autoload": { 35 | "psr-4": { 36 | "<%= pluginVendorName %>\\<%= pluginDirName %>\\": "src/" 37 | } 38 | }, 39 | "extra": { 40 | "name": "<%- pluginName %>", 41 | "handle": "<%= pluginKebabHandle %>", 42 | "developer": "<%= pluginAuthorName %>", 43 | "developerUrl": "<%= pluginAuthorUrl %>", 44 | "documentationUrl": "<%= pluginDocsUrl %>", 45 | "changelogUrl": "<%= pluginChangelogUrl %>", 46 | <% if (pluginComponents.indexOf('services') >= 0){ -%> 47 | <% var components = serviceName -%> 48 | <% if ((typeof(components[0]) !== 'undefined') && (components[0] !== "")) { -%> 49 | "components": { 50 | <% components.forEach(function(component, index, array){ -%> 51 | "<%= component[0].toLowerCase() + component.slice(1) %>": "<%= pluginVendorName %>\\<%= pluginDirName%>\\services\\<%= component%>"<% if (index !== array.length - 1) { %>,<% } %> 52 | <% }); -%> 53 | }, 54 | <% } -%> 55 | <% } -%> 56 | "class": "<%= pluginVendorName %>\\<%= pluginDirName %>\\<%= pluginHandle %>" 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/templates/_index.twig: -------------------------------------------------------------------------------- 1 | {# @var craft \craft\web\twig\variables\CraftVariable #} 2 | {# 3 | /** 4 | * <%- pluginName %> plugin for Craft CMS 3.x 5 | * 6 | * <%- pluginName %> index.twig 7 | * 8 | * @author <%- pluginAuthorName %> 9 | * @copyright <%- copyrightNotice %> 10 | * @link <%= pluginAuthorUrl %> 11 | * @package <%= pluginHandle %> 12 | * @since <%= pluginVersion %> 13 | */ 14 | #} 15 | <% var shouldRedirect = false -%> 16 | <% if ((pluginComponents.indexOf('cpsection') >= 0) && (typeof cpsectionName !== 'undefined')){ -%> 17 | <% var cpsections = cpsectionName -%> 18 | <% if ((typeof(cpsections[0]) !== 'undefined') && (cpsections[0] !== "Index") && (cpsections.length > 1)) { -%> 19 | <% var shouldRedirect = true -%> 20 | <% } -%> 21 | <% } -%> 22 | 23 | <% if (shouldRedirect) { -%> 24 | {% redirect url('<%= pluginDirName %>/<%= cpsections[0].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>') %} 25 | <% } else { -%> 26 | {% extends "_layouts/cp" %} 27 | {% import "_includes/forms" as forms %} 28 | 29 | {% do view.registerAssetBundle("<%= pluginVendorName %>\\<%= pluginDirName %>\\assetbundles\\<%= pluginDirName %>\\<%= pluginHandle %>Asset") %} 30 | {% do view.registerAssetBundle("<%= pluginVendorName %>\\<%= pluginDirName %>\\assetbundles\\<%= cpsectionName[0].toLowerCase() %>cpsection\\<%= cpsectionName[0] %>CPSectionAsset") %} 31 | 32 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 33 | {# Link for the ? icon at the bottom of the page #} 34 | <% } -%> 35 | {% set docsUrl = "<%= pluginDocsUrl %>" %} 36 | 37 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 38 | {# The title of this CP section #} 39 | <% } -%> 40 | {% set title = "<%- pluginName %>" %} 41 | 42 | {% set extraPageHeaderHtml %} 43 |
44 | {{ "Click Me!"|t('<%= pluginKebabHandle %>') }} 45 |
46 | {% endset %} 47 | 48 | {% set content %} 49 | 50 |

{{ "Dynamic Entry Redirects"|t('<%= pluginKebabHandle %>') }}

51 | 52 |

53 | 54 | {% endset %} 55 | <% } -%> 56 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/variables/_Variable.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\variables; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%- pluginName %> Variable 20 | * 21 | * Craft allows modules to provide their own template variables, accessible from 22 | * the {{ craft }} global variable (e.g. {{ craft.<%= pluginCamelHandle %> }}). 23 | * 24 | * https://craftcms.com/docs/plugins/variables 25 | * 26 | * @author <%- pluginAuthorName %> 27 | * @package <%= pluginHandle %> 28 | * @since <%= pluginVersion %> 29 | */ 30 | <% } else { -%> 31 | /** 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } -%> 37 | class <%= pluginHandle %>Variable 38 | { 39 | // Public Methods 40 | // ========================================================================= 41 | 42 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 43 | /** 44 | * Whatever you want to output to a Twig template can go into a Variable method. 45 | * You can have as many variable functions as you want. From any Twig template, 46 | * call it like this: 47 | * 48 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable }} 49 | * 50 | * Or, if your variable requires parameters from Twig: 51 | * 52 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable(twigValue) }} 53 | * 54 | * @param null $optional 55 | * @return string 56 | */ 57 | <% } else { -%> 58 | /** 59 | * @param null $optional 60 | * @return string 61 | */ 62 | <% } -%> 63 | public function exampleVariable($optional = null) 64 | { 65 | $result = "And away we go to the Twig template..."; 66 | if ($optional) { 67 | $result = "I'm feeling optional today..."; 68 | } 69 | return $result; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/_README.md: -------------------------------------------------------------------------------- 1 | # <%- pluginName %> module for Craft CMS 3.x 2 | 3 | <%- pluginDescription %> 4 | 5 | ## Requirements 6 | 7 | This module requires Craft CMS 3.0.0-RC1 or later. 8 | 9 | ## Installation 10 | 11 | To install the module, follow these instructions. 12 | 13 | First, you'll need to add the contents of the `app.php` file to your `config/app.php` (or just copy it there if it does not exist). This ensures that your module will get loaded for each request. The file might look something like this: 14 | ``` 15 | return [ 16 | 'modules' => [ 17 | '<%= pluginKebabHandle %>' => [ 18 | 'class' => \modules\<%= pluginDirName %>\<%= pluginHandle %>::class, 19 | <% if (pluginComponents.indexOf('services') >= 0){ -%> 20 | <% var components = serviceName -%> 21 | <% if ((typeof(components[0]) !== 'undefined') && (components[0] !== "")) { -%> 22 | 'components' => [ 23 | <% components.forEach(function(component, index, array){ -%> 24 | '<%= component[0].toLowerCase() + component.slice(1) %>' => [ 25 | 'class' => 'modules\<%= pluginDirName %>\services\<%= component%>', 26 | ], 27 | <% }); -%> 28 | ], 29 | <% } -%> 30 | <% } -%> 31 | ], 32 | ], 33 | 'bootstrap' => ['<%= pluginKebabHandle %>'], 34 | ]; 35 | ``` 36 | You'll also need to make sure that you add the following to your project's `composer.json` file so that Composer can find your module: 37 | 38 | "autoload": { 39 | "psr-4": { 40 | "modules\\<%= pluginDirName %>\\": "modules/<%= pluginDirName %>/src/" 41 | } 42 | }, 43 | 44 | After you have added this, you will need to do: 45 | 46 | composer dump-autoload 47 | 48 | …from the project’s root directory, to rebuild the Composer autoload map. This will happen automatically any time you do a `composer install` or `composer update` as well. 49 | 50 | ## <%- pluginName %> Overview 51 | 52 | -Insert text here- 53 | 54 | ## Using <%- pluginName %> 55 | 56 | -Insert text here- 57 | 58 | ## <%- pluginName %> Roadmap 59 | 60 | Some things to do, and ideas for potential features: 61 | 62 | * Release it 63 | 64 | Brought to you by [<%- pluginAuthorName %>](<%= pluginAuthorUrl %>) 65 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/variables/_Variable.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\variables; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%- pluginName %> Variable 20 | * 21 | * Craft allows plugins to provide their own template variables, accessible from 22 | * the {{ craft }} global variable (e.g. {{ craft.<%= pluginCamelHandle %> }}). 23 | * 24 | * https://craftcms.com/docs/plugins/variables 25 | * 26 | * @author <%- pluginAuthorName %> 27 | * @package <%= pluginHandle %> 28 | * @since <%= pluginVersion %> 29 | */ 30 | <% } else { -%> 31 | /** 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } -%> 37 | class <%= pluginHandle %>Variable 38 | { 39 | // Public Methods 40 | // ========================================================================= 41 | 42 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 43 | /** 44 | * Whatever you want to output to a Twig template can go into a Variable method. 45 | * You can have as many variable functions as you want. From any Twig template, 46 | * call it like this: 47 | * 48 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable }} 49 | * 50 | * Or, if your variable requires parameters from Twig: 51 | * 52 | * {{ craft.<%= pluginCamelHandle %>.exampleVariable(twigValue) }} 53 | * 54 | * @param null $optional 55 | * @return string 56 | */ 57 | <% } else { -%> 58 | /** 59 | * @param null $optional 60 | * @return string 61 | */ 62 | <% } -%> 63 | public function exampleVariable($optional = null) 64 | { 65 | $result = "And away we go to the Twig template..."; 66 | if ($optional) { 67 | $result = "I'm feeling optional today..."; 68 | } 69 | return $result; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/services/_Service.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName%>\services; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\base\Component; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= serviceName[index] %> Service 21 | * 22 | * All of your plugin’s business logic should go in services, including saving data, 23 | * retrieving data, etc. They provide APIs that your controllers, template variables, 24 | * and other plugins can interact with. 25 | * 26 | * https://craftcms.com/docs/plugins/services 27 | * 28 | * @author <%- pluginAuthorName %> 29 | * @package <%= pluginHandle %> 30 | * @since <%= pluginVersion %> 31 | */ 32 | <% } else { -%> 33 | /** 34 | * @author <%- pluginAuthorName %> 35 | * @package <%= pluginHandle %> 36 | * @since <%= pluginVersion %> 37 | */ 38 | <% } -%> 39 | class <%= serviceName[index] %> extends Component 40 | { 41 | // Public Methods 42 | // ========================================================================= 43 | 44 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 45 | /** 46 | * This function can literally be anything you want, and you can have as many service 47 | * functions as you want 48 | * 49 | * From any other plugin file, call it like this: 50 | * 51 | * <%= pluginHandle %>::$plugin-><%= serviceName[index][0].toLowerCase() + serviceName[index].slice(1) %>->exampleService() 52 | * 53 | * @return mixed 54 | */ 55 | <% } else { -%> 56 | /* 57 | * @return mixed 58 | */ 59 | <% } -%> 60 | public function exampleService() 61 | { 62 | $result = 'something'; 63 | <% if (pluginComponents.indexOf('settings') >= 0){ -%> 64 | // Check our Plugin's settings for `someAttribute` 65 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 66 | <% } else { -%> 67 | <% } -%> 68 | if (<%= pluginHandle %>::$plugin->getSettings()->someAttribute) { 69 | } 70 | <% } -%> 71 | 72 | return $result; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/tasks/_Task.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= taskName[index] %> Task 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Tasks let you run background processing for things that take a long time, dividing them up into steps. For 10 | * example, Asset Transforms are regenerated using Tasks. 11 | * 12 | * Keep in mind that tasks only get timeslices to run when Craft is handling requests on your website. If you 13 | * need a task to be run on a regular basis, write a Controller that triggers it, and set up a cron job to 14 | * trigger the controller. 15 | * 16 | * https://craftcms.com/classreference/services/TasksService 17 | * --snip-- 18 | * 19 | <% } -%> 20 | * @author <%= pluginAuthorName %> 21 | * @copyright <%= copyrightNotice %> 22 | * @link <%= pluginAuthorUrl %> 23 | * @package <%= pluginHandle %> 24 | * @since <%= pluginVersion %> 25 | */ 26 | 27 | namespace Craft; 28 | 29 | class <%= pluginHandle %><%= taskName[index] %>Task extends BaseTask 30 | { 31 | /** 32 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 33 | * Defines the settings. 34 | * 35 | <% } -%> 36 | * @access protected 37 | * @return array 38 | */ 39 | 40 | protected function defineSettings() 41 | { 42 | return array( 43 | 'someSetting' => AttributeType::String, 44 | ); 45 | } 46 | 47 | /** 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 49 | * Returns the default description for this task. 50 | * 51 | <% } -%> 52 | * @return string 53 | */ 54 | public function getDescription() 55 | { 56 | return '<%= pluginHandle %><%= taskName[index] %> Tasks'; 57 | } 58 | 59 | /** 60 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 61 | * Gets the total number of steps for this task. 62 | * 63 | <% } -%> 64 | * @return int 65 | */ 66 | public function getTotalSteps() 67 | { 68 | return 1; 69 | } 70 | 71 | /** 72 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 73 | * Runs a task step. 74 | * 75 | <% } -%> 76 | * @param int $step 77 | * @return bool 78 | */ 79 | public function runStep($step) 80 | { 81 | return true; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/models/_Model.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\models; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\base\Model; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= modelName[index] %> Model 21 | * 22 | * Models are containers for data. Just about every time information is passed 23 | * between services, controllers, and templates in Craft, it’s passed via a model. 24 | * 25 | * https://craftcms.com/docs/plugins/models 26 | * 27 | * @author <%- pluginAuthorName %> 28 | * @package <%= pluginHandle %> 29 | * @since <%= pluginVersion %> 30 | */ 31 | <% } else { -%> 32 | /** 33 | * @author <%- pluginAuthorName %> 34 | * @package <%= pluginHandle %> 35 | * @since <%= pluginVersion %> 36 | */ 37 | <% } -%> 38 | class <%= modelName[index] %> extends Model 39 | { 40 | // Public Properties 41 | // ========================================================================= 42 | 43 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 44 | /** 45 | * Some model attribute 46 | * 47 | * @var string 48 | */ 49 | <% } else { -%> 50 | /** 51 | * @var string 52 | */ 53 | <% } -%> 54 | public $someAttribute = 'Some Default'; 55 | 56 | // Public Methods 57 | // ========================================================================= 58 | 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | /** 61 | * Returns the validation rules for attributes. 62 | * 63 | * Validation rules are used by [[validate()]] to check if attribute values are valid. 64 | * Child classes may override this method to declare different validation rules. 65 | * 66 | * More info: http://www.yiiframework.com/doc-2.0/guide-input-validation.html 67 | * 68 | * @return array 69 | */ 70 | <% } else { -%> 71 | /** 72 | * @inheritdoc 73 | */ 74 | <% } -%> 75 | public function rules() 76 | { 77 | return [ 78 | ['someAttribute', 'string'], 79 | ['someAttribute', 'default', 'value' => 'Some Default'], 80 | ]; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/models/_Model.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\models; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\base\Model; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= modelName[index] %> Model 21 | * 22 | * Models are containers for data. Just about every time information is passed 23 | * between services, controllers, and templates in Craft, it’s passed via a model. 24 | * 25 | * https://craftcms.com/docs/plugins/models 26 | * 27 | * @author <%- pluginAuthorName %> 28 | * @package <%= pluginHandle %> 29 | * @since <%= pluginVersion %> 30 | */ 31 | <% } else { -%> 32 | /** 33 | * @author <%- pluginAuthorName %> 34 | * @package <%= pluginHandle %> 35 | * @since <%= pluginVersion %> 36 | */ 37 | <% } -%> 38 | class <%= modelName[index] %> extends Model 39 | { 40 | // Public Properties 41 | // ========================================================================= 42 | 43 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 44 | /** 45 | * Some model attribute 46 | * 47 | * @var string 48 | */ 49 | <% } else { -%> 50 | /** 51 | * @var string 52 | */ 53 | <% } -%> 54 | public $someAttribute = 'Some Default'; 55 | 56 | // Public Methods 57 | // ========================================================================= 58 | 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | /** 61 | * Returns the validation rules for attributes. 62 | * 63 | * Validation rules are used by [[validate()]] to check if attribute values are valid. 64 | * Child classes may override this method to declare different validation rules. 65 | * 66 | * More info: http://www.yiiframework.com/doc-2.0/guide-input-validation.html 67 | * 68 | * @return array 69 | */ 70 | <% } else { -%> 71 | /** 72 | * @inheritdoc 73 | */ 74 | <% } -%> 75 | public function rules() 76 | { 77 | return [ 78 | ['someAttribute', 'string'], 79 | ['someAttribute', 'default', 'value' => 'Some Default'], 80 | ]; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/models/_Settings.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName%>\models; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\base\Model; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= pluginHandle %> Settings Model 21 | * 22 | * This is a model used to define the plugin's settings. 23 | * 24 | * Models are containers for data. Just about every time information is passed 25 | * between services, controllers, and templates in Craft, it’s passed via a model. 26 | * 27 | * https://craftcms.com/docs/plugins/models 28 | * 29 | * @author <%- pluginAuthorName %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | <% } else { -%> 34 | /** 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } -%> 40 | class Settings extends Model 41 | { 42 | // Public Properties 43 | // ========================================================================= 44 | 45 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 46 | /** 47 | * Some field model attribute 48 | * 49 | * @var string 50 | */ 51 | <% } else { -%> 52 | /** 53 | * @var string 54 | */ 55 | <% } -%> 56 | public $someAttribute = 'Some Default'; 57 | 58 | // Public Methods 59 | // ========================================================================= 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Returns the validation rules for attributes. 64 | * 65 | * Validation rules are used by [[validate()]] to check if attribute values are valid. 66 | * Child classes may override this method to declare different validation rules. 67 | * 68 | * More info: http://www.yiiframework.com/doc-2.0/guide-input-validation.html 69 | * 70 | * @return array 71 | */ 72 | <% } else { -%> 73 | /** 74 | * @inheritdoc 75 | */ 76 | <% } -%> 77 | public function rules() 78 | { 79 | return [ 80 | ['someAttribute', 'string'], 81 | ['someAttribute', 'default', 'value' => 'Some Default'], 82 | ]; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/twigextensions/_TwigExtension.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginName %> Twig Extension 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Twig can be extended in many ways; you can add extra tags, filters, tests, operators, global variables, and 10 | * functions. You can even extend the parser itself with node visitors. 11 | * 12 | * http://twig.sensiolabs.org/doc/advanced.html 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | use Twig_Extension; 26 | use Twig_Filter_Method; 27 | 28 | class <%= pluginHandle %>TwigExtension extends \Twig_Extension 29 | { 30 | /** 31 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 32 | * Returns the name of the extension. 33 | * 34 | <% } -%> 35 | * @return string The extension name 36 | */ 37 | public function getName() 38 | { 39 | return '<%= pluginHandle %>'; 40 | } 41 | 42 | /** 43 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 44 | * Returns an array of Twig filters, used in Twig templates via: 45 | * 46 | * {{ 'something' | someFilter }} 47 | * 48 | <% } -%> 49 | * @return array 50 | */ 51 | public function getFilters() 52 | { 53 | return array( 54 | 'someFilter' => new \Twig_Filter_Method($this, 'someInternalFunction'), 55 | ); 56 | } 57 | 58 | /** 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 60 | * Returns an array of Twig functions, used in Twig templates via: 61 | * 62 | * {% set this = someFunction('something') %} 63 | * 64 | <% } -%> 65 | * @return array 66 | */ 67 | public function getFunctions() 68 | { 69 | return array( 70 | 'someFunction' => new \Twig_Function_Method($this, 'someInternalFunction'), 71 | ); 72 | } 73 | 74 | /** 75 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 76 | * Our function called via Twig; it can do anything you want 77 | * 78 | <% } -%> 79 | * @return string 80 | */ 81 | public function someInternalFunction($text = null) 82 | { 83 | $result = $text . " in the way"; 84 | 85 | return $result; 86 | } 87 | } -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/records/_Record.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\records; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\db\ActiveRecord; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= recordName[index] %> Record 21 | * 22 | * ActiveRecord is the base class for classes representing relational data in terms of objects. 23 | * 24 | * Active Record implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record). 25 | * The premise behind Active Record is that an individual [[ActiveRecord]] object is associated with a specific 26 | * row in a database table. The object's attributes are mapped to the columns of the corresponding table. 27 | * Referencing an Active Record attribute is equivalent to accessing the corresponding table column for that record. 28 | * 29 | * http://www.yiiframework.com/doc-2.0/guide-db-active-record.html 30 | * 31 | * @author <%- pluginAuthorName %> 32 | * @package <%= pluginHandle %> 33 | * @since <%= pluginVersion %> 34 | */ 35 | <% } else { -%> 36 | /** 37 | * @author <%- pluginAuthorName %> 38 | * @package <%= pluginHandle %> 39 | * @since <%= pluginVersion %> 40 | */ 41 | <% } -%> 42 | class <%= recordName[index] %> extends ActiveRecord 43 | { 44 | // Public Static Methods 45 | // ========================================================================= 46 | 47 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 48 | /** 49 | * Declares the name of the database table associated with this AR class. 50 | * By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] 51 | * with prefix [[Connection::tablePrefix]]. For example if [[Connection::tablePrefix]] is `tbl_`, 52 | * `Customer` becomes `tbl_customer`, and `OrderItem` becomes `tbl_order_item`. You may override this method 53 | * if the table is not named after this convention. 54 | * 55 | * By convention, tables created by modules should be prefixed with the module's 56 | * name and an underscore. 57 | * 58 | * @return string the table name 59 | */ 60 | <% } else { -%> 61 | /** 62 | * @inheritdoc 63 | */ 64 | <% } -%> 65 | public static function tableName() 66 | { 67 | return '{{%<%= pluginDirName %>_<%= recordName[index].toLowerCase() %>}}'; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/records/_Record.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\records; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\db\ActiveRecord; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= recordName[index] %> Record 21 | * 22 | * ActiveRecord is the base class for classes representing relational data in terms of objects. 23 | * 24 | * Active Record implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record). 25 | * The premise behind Active Record is that an individual [[ActiveRecord]] object is associated with a specific 26 | * row in a database table. The object's attributes are mapped to the columns of the corresponding table. 27 | * Referencing an Active Record attribute is equivalent to accessing the corresponding table column for that record. 28 | * 29 | * http://www.yiiframework.com/doc-2.0/guide-db-active-record.html 30 | * 31 | * @author <%- pluginAuthorName %> 32 | * @package <%= pluginHandle %> 33 | * @since <%= pluginVersion %> 34 | */ 35 | <% } else { -%> 36 | /** 37 | * @author <%- pluginAuthorName %> 38 | * @package <%= pluginHandle %> 39 | * @since <%= pluginVersion %> 40 | */ 41 | <% } -%> 42 | class <%= recordName[index] %> extends ActiveRecord 43 | { 44 | // Public Static Methods 45 | // ========================================================================= 46 | 47 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 48 | /** 49 | * Declares the name of the database table associated with this AR class. 50 | * By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] 51 | * with prefix [[Connection::tablePrefix]]. For example if [[Connection::tablePrefix]] is `tbl_`, 52 | * `Customer` becomes `tbl_customer`, and `OrderItem` becomes `tbl_order_item`. You may override this method 53 | * if the table is not named after this convention. 54 | * 55 | * By convention, tables created by plugins should be prefixed with the plugin 56 | * name and an underscore. 57 | * 58 | * @return string the table name 59 | */ 60 | <% } else { -%> 61 | /** 62 | * @inheritdoc 63 | */ 64 | <% } -%> 65 | public static function tableName() 66 | { 67 | return '{{%<%= pluginDirName %>_<%= recordName[index].toLowerCase() %>}}'; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/records/_Record.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= recordName[index] %> Record 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Active record models (or “records”) are like models, except with a database-facing layer built on top. On top of 10 | * all the things that models can do, records can: 11 | * 12 | * - Define database table schemas 13 | * - Represent rows in the database 14 | * - Find, alter, and delete rows 15 | * 16 | * Note: Records’ ability to modify the database means that they should never be used to transport data throughout 17 | * the system. Their instances should be contained to services only, so that services remain the one and only place 18 | * where system state changes ever occur. 19 | * 20 | * When a plugin is installed, Craft will look for any records provided by the plugin, and automatically create the 21 | * database tables for them. 22 | * 23 | * https://craftcms.com/docs/plugins/records 24 | * --snip-- 25 | * 26 | <% } -%> 27 | * @author <%= pluginAuthorName %> 28 | * @copyright <%= copyrightNotice %> 29 | * @link <%= pluginAuthorUrl %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | 34 | namespace Craft; 35 | 36 | class <%= pluginHandle %><%= recordName[index] %>Record extends BaseRecord 37 | { 38 | /** 39 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 40 | * Returns the name of the database table the model is associated with (sans table prefix). By convention, 41 | * tables created by plugins should be prefixed with the plugin name and an underscore. 42 | * 43 | <% } -%> 44 | * @return string 45 | */ 46 | public function getTableName() 47 | { 48 | return '<%= pluginDirName %><%= recordName[index] %>'; 49 | } 50 | 51 | /** 52 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 53 | * Returns an array of attributes which map back to columns in the database table. 54 | * 55 | <% } -%> 56 | * @access protected 57 | * @return array 58 | */ 59 | protected function defineAttributes() 60 | { 61 | return array( 62 | 'someField' => array(AttributeType::String, 'default' => ''), 63 | ); 64 | } 65 | 66 | /** 67 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 68 | * If your record should have any relationships with other tables, you can specify them with the 69 | * defineRelations() function 70 | * 71 | <% } -%> 72 | * @return array 73 | */ 74 | public function defineRelations() 75 | { 76 | return array( 77 | ); 78 | } 79 | } -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/cpsectionresources/dist/img/cpsection.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/records/_ElementRecord.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= elementName[index] %> Record 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Active record models (or “records”) are like models, except with a database-facing layer built on top. On top of 10 | * all the things that models can do, records can: 11 | * 12 | * - Define database table schemas 13 | * - Represent rows in the database 14 | * - Find, alter, and delete rows 15 | * 16 | * Note: Records’ ability to modify the database means that they should never be used to transport data throughout 17 | * the system. Their instances should be contained to services only, so that services remain the one and only place 18 | * where system state changes ever occur. 19 | * 20 | * When a plugin is installed, Craft will look for any records provided by the plugin, and automatically create the 21 | * database tables for them. 22 | * 23 | * https://craftcms.com/docs/plugins/records 24 | * --snip-- 25 | * 26 | <% } -%> 27 | * @author <%= pluginAuthorName %> 28 | * @copyright <%= copyrightNotice %> 29 | * @link <%= pluginAuthorUrl %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | 34 | namespace Craft; 35 | 36 | class <%= pluginHandle %><%= elementName[index] %>Record extends BaseRecord 37 | { 38 | /** 39 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 40 | * Returns the name of the database table the model is associated with (sans table prefix). By convention, 41 | * tables created by plugins should be prefixed with the plugin name and an underscore. 42 | * 43 | <% } -%> 44 | * @return string 45 | */ 46 | public function getTableName() 47 | { 48 | return '<%= pluginDirName %><%= elementName[index] %>'; 49 | } 50 | 51 | /** 52 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 53 | * Returns an array of attributes which map back to columns in the database table. 54 | * 55 | <% } -%> 56 | * @access protected 57 | * @return array 58 | */ 59 | protected function defineAttributes() 60 | { 61 | return array( 62 | 'someField' => array(AttributeType::String, 'default' => ''), 63 | ); 64 | } 65 | 66 | /** 67 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 68 | * If your record should have any relationships with other tables, you can specify them with the 69 | * defineRelations() function 70 | * 71 | <% } -%> 72 | * @return array 73 | */ 74 | public function defineRelations() 75 | { 76 | return array( 77 | ); 78 | } 79 | } -------------------------------------------------------------------------------- /app/templates/api_version_2_5/records/_PurchasableRecord.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= purchasableName[index] %> Record 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Active record models (or “records”) are like models, except with a database-facing layer built on top. On top of 10 | * all the things that models can do, records can: 11 | * 12 | * - Define database table schemas 13 | * - Represent rows in the database 14 | * - Find, alter, and delete rows 15 | * 16 | * Note: Records’ ability to modify the database means that they should never be used to transport data throughout 17 | * the system. Their instances should be contained to services only, so that services remain the one and only place 18 | * where system state changes ever occur. 19 | * 20 | * When a plugin is installed, Craft will look for any records provided by the plugin, and automatically create the 21 | * database tables for them. 22 | * 23 | * https://craftcms.com/docs/plugins/records 24 | * --snip-- 25 | * 26 | <% } -%> 27 | * @author <%= pluginAuthorName %> 28 | * @copyright <%= copyrightNotice %> 29 | * @link <%= pluginAuthorUrl %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | 34 | namespace Craft; 35 | 36 | class <%= pluginHandle %><%= purchasableName[index] %>Record extends BaseRecord 37 | { 38 | /** 39 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 40 | * Returns the name of the database table the model is associated with (sans table prefix). By convention, 41 | * tables created by plugins should be prefixed with the plugin name and an underscore. 42 | * 43 | <% } -%> 44 | * @return string 45 | */ 46 | public function getTableName() 47 | { 48 | return '<%= pluginDirName %><%= purchasableName[index] %>'; 49 | } 50 | 51 | /** 52 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 53 | * Returns an array of attributes which map back to columns in the database table. 54 | * 55 | <% } -%> 56 | * @access protected 57 | * @return array 58 | */ 59 | protected function defineAttributes() 60 | { 61 | return array( 62 | 'someField' => array(AttributeType::String, 'default' => ''), 63 | ); 64 | } 65 | 66 | /** 67 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 68 | * If your record should have any relationships with other tables, you can specify them with the 69 | * defineRelations() function 70 | * 71 | <% } -%> 72 | * @return array 73 | */ 74 | public function defineRelations() 75 | { 76 | return array( 77 | ); 78 | } 79 | } -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/moduleresources/_ModuleAssetBundle.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\assetbundles\<%= pluginHandle.toLowerCase() %>; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= pluginHandle %>Asset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= pluginHandle %>Asset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@modules/<%= pluginDirName %>/assetbundles/<%= pluginDirName.toLowerCase() %>/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= pluginHandle %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= pluginHandle %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/pluginresources/_PluginAssetBundle.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= pluginHandle.toLowerCase() %>; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= pluginHandle %>Asset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= pluginHandle %>Asset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= pluginDirName.toLowerCase() %>/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= pluginHandle %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= pluginHandle %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/fieldresources/_FieldAssetBundle.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\assetbundles\<%= fieldName[index].toLowerCase() %>field; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= fieldName[index] %>FieldAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= fieldName[index] %>FieldAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@modules/<%= pluginDirName %>/assetbundles/<%= fieldName[index].toLowerCase() %>field/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= fieldName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= fieldName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/widgetresources/_WidgetAssetBundle.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\assetbundles\<%= widgetName[index].toLowerCase() %>widget; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= widgetName[index] %>WidgetAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= widgetName[index] %>WidgetAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@modules/<%= pluginDirName %>/assetbundles/<%= widgetName[index].toLowerCase() %>widget/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= widgetName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= widgetName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/fieldresources/_FieldAssetBundle.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= fieldName[index].toLowerCase() %>field; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= fieldName[index] %>FieldAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= fieldName[index] %>FieldAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= fieldName[index].toLowerCase() %>field/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= fieldName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= fieldName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/utilityresources/_UtilityAssetBundle.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\assetbundles\<%= utilityName[index].toLowerCase() %>utility; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= utilityName[index] %>UtilityAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= utilityName[index] %>UtilityAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@modules/<%= pluginDirName %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= utilityName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= utilityName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/widgetresources/_WidgetAssetBundle.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= widgetName[index].toLowerCase() %>widget; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= widgetName[index] %>WidgetAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= widgetName[index] %>WidgetAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= widgetName[index].toLowerCase() %>widget/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= widgetName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= widgetName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/utilityresources/_UtilityAssetBundle.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= utilityName[index].toLowerCase() %>utility; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= utilityName[index] %>UtilityAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= utilityName[index] %>UtilityAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= utilityName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= utilityName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/cpsectionresources/_CPSectionAssetBundle.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= cpsectionName[index].toLowerCase() %>cpsection; 12 | 13 | use Craft; 14 | use craft\web\AssetBundle; 15 | use craft\web\assets\cp\CpAsset; 16 | 17 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 18 | /** 19 | * <%= cpsectionName[index] %>CPSectionAsset AssetBundle 20 | * 21 | * AssetBundle represents a collection of asset files, such as CSS, JS, images. 22 | * 23 | * Each asset bundle has a unique name that globally identifies it among all asset bundles used in an application. 24 | * The name is the [fully qualified class name](http://php.net/manual/en/language.namespaces.rules.php) 25 | * of the class representing it. 26 | * 27 | * An asset bundle can depend on other asset bundles. When registering an asset bundle 28 | * with a view, all its dependent asset bundles will be automatically registered. 29 | * 30 | * http://www.yiiframework.com/doc-2.0/guide-structure-assets.html 31 | * 32 | * @author <%- pluginAuthorName %> 33 | * @package <%= pluginHandle %> 34 | * @since <%= pluginVersion %> 35 | */ 36 | <% } else { -%> 37 | /** 38 | * @author <%- pluginAuthorName %> 39 | * @package <%= pluginHandle %> 40 | * @since <%= pluginVersion %> 41 | */ 42 | <% } -%> 43 | class <%= cpsectionName[index] %>CPSectionAsset extends AssetBundle 44 | { 45 | // Public Methods 46 | // ========================================================================= 47 | 48 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 49 | /** 50 | * Initializes the bundle. 51 | */ 52 | <% } else { -%> 53 | /** 54 | * @inheritdoc 55 | */ 56 | <% } -%> 57 | public function init() 58 | { 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | // define the path that your publishable resources live 61 | <% } -%> 62 | $this->sourcePath = "@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= cpsectionName[index].toLowerCase() %>cpsection/dist"; 63 | 64 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 65 | // define the dependencies 66 | <% } -%> 67 | $this->depends = [ 68 | CpAsset::class, 69 | ]; 70 | 71 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 72 | // define the relative path to CSS/JS files that should be registered with the page 73 | // when this asset bundle is registered 74 | <% } -%> 75 | $this->js = [ 76 | 'js/<%= cpsectionName[index] %>.js', 77 | ]; 78 | 79 | $this->css = [ 80 | 'css/<%= cpsectionName[index] %>.css', 81 | ]; 82 | 83 | parent::init(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/twigextensions/_TwigExtension.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\twigextensions; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | 17 | use Twig\Extension\AbstractExtension; 18 | use Twig\TwigFilter; 19 | use Twig\TwigFunction; 20 | 21 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 22 | /** 23 | * Twig can be extended in many ways; you can add extra tags, filters, tests, operators, 24 | * global variables, and functions. You can even extend the parser itself with 25 | * node visitors. 26 | * 27 | * http://twig.sensiolabs.org/doc/advanced.html 28 | * 29 | * @author <%- pluginAuthorName %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | <% } else { -%> 34 | /** 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } -%> 40 | class <%= pluginHandle %>TwigExtension extends AbstractExtension 41 | { 42 | // Public Methods 43 | // ========================================================================= 44 | 45 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 46 | /** 47 | * Returns the name of the extension. 48 | * 49 | * @return string The extension name 50 | */ 51 | <% } else { -%> 52 | /** 53 | * @inheritdoc 54 | */ 55 | <% } -%> 56 | public function getName() 57 | { 58 | return '<%= pluginHandle %>'; 59 | } 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Returns an array of Twig filters, used in Twig templates via: 64 | * 65 | * {{ 'something' | someFilter }} 66 | * 67 | * @return array 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @inheritdoc 72 | */ 73 | <% } -%> 74 | public function getFilters() 75 | { 76 | return [ 77 | new TwigFilter('someFilter', [$this, 'someInternalFunction']), 78 | ]; 79 | } 80 | 81 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 82 | /** 83 | * Returns an array of Twig functions, used in Twig templates via: 84 | * 85 | * {% set this = someFunction('something') %} 86 | * 87 | * @return array 88 | */ 89 | <% } else { -%> 90 | /** 91 | * @inheritdoc 92 | */ 93 | <% } -%> 94 | public function getFunctions() 95 | { 96 | return [ 97 | new TwigFunction('someFunction', [$this, 'someInternalFunction']), 98 | ]; 99 | } 100 | 101 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 102 | /** 103 | * Our function called via Twig; it can do anything you want 104 | * 105 | * @param null $text 106 | * 107 | * @return string 108 | */ 109 | <% } else { -%> 110 | /** 111 | * @param null $text 112 | * 113 | * @return string 114 | */ 115 | <% } -%> 116 | public function someInternalFunction($text = null) 117 | { 118 | $result = $text . " in the way"; 119 | 120 | return $result; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/twigextensions/_TwigExtension.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\twigextensions; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | 17 | use Twig\Extension\AbstractExtension; 18 | use Twig\TwigFilter; 19 | use Twig\TwigFunction; 20 | 21 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 22 | /** 23 | * Twig can be extended in many ways; you can add extra tags, filters, tests, operators, 24 | * global variables, and functions. You can even extend the parser itself with 25 | * node visitors. 26 | * 27 | * http://twig.sensiolabs.org/doc/advanced.html 28 | * 29 | * @author <%- pluginAuthorName %> 30 | * @package <%= pluginHandle %> 31 | * @since <%= pluginVersion %> 32 | */ 33 | <% } else { -%> 34 | /** 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } -%> 40 | class <%= pluginHandle %>TwigExtension extends AbstractExtension 41 | { 42 | // Public Methods 43 | // ========================================================================= 44 | 45 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 46 | /** 47 | * Returns the name of the extension. 48 | * 49 | * @return string The extension name 50 | */ 51 | <% } else { -%> 52 | /** 53 | * @inheritdoc 54 | */ 55 | <% } -%> 56 | public function getName() 57 | { 58 | return '<%= pluginHandle %>'; 59 | } 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Returns an array of Twig filters, used in Twig templates via: 64 | * 65 | * {{ 'something' | someFilter }} 66 | * 67 | * @return array 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @inheritdoc 72 | */ 73 | <% } -%> 74 | public function getFilters() 75 | { 76 | return [ 77 | new TwigFilter('someFilter', [$this, 'someInternalFunction']), 78 | ]; 79 | } 80 | 81 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 82 | /** 83 | * Returns an array of Twig functions, used in Twig templates via: 84 | * 85 | * {% set this = someFunction('something') %} 86 | * 87 | * @return array 88 | */ 89 | <% } else { -%> 90 | /** 91 | * @inheritdoc 92 | */ 93 | <% } -%> 94 | public function getFunctions() 95 | { 96 | return [ 97 | new TwigFunction('someFunction', [$this, 'someInternalFunction']), 98 | ]; 99 | } 100 | 101 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 102 | /** 103 | * Our function called via Twig; it can do anything you want 104 | * 105 | * @param null $text 106 | * 107 | * @return string 108 | */ 109 | <% } else { -%> 110 | /** 111 | * @param null $text 112 | * 113 | * @return string 114 | */ 115 | <% } -%> 116 | public function someInternalFunction($text = null) 117 | { 118 | $result = $text . " in the way"; 119 | 120 | return $result; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/controllers/_Controller.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\controllers; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\web\Controller; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= controllerName[index] %> Controller 21 | * 22 | * Generally speaking, controllers are the middlemen between the front end of 23 | * the CP/website and your module’s services. They contain action methods which 24 | * handle individual tasks. 25 | * 26 | * A common pattern used throughout Craft involves a controller action gathering 27 | * post data, saving it on a model, passing the model off to a service, and then 28 | * responding to the request appropriately depending on the service method’s response. 29 | * 30 | * Action methods begin with the prefix “action”, followed by a description of what 31 | * the method does (for example, actionSaveIngredient()). 32 | * 33 | * https://craftcms.com/docs/plugins/controllers 34 | * 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } else { -%> 40 | /** 41 | * @author <%- pluginAuthorName %> 42 | * @package <%= pluginHandle %> 43 | * @since <%= pluginVersion %> 44 | */ 45 | <% } -%> 46 | class <%= controllerName[index] %>Controller extends Controller 47 | { 48 | 49 | // Protected Properties 50 | // ========================================================================= 51 | 52 | /** 53 | * @var bool|array Allows anonymous access to this controller's actions. 54 | * The actions must be in 'kebab-case' 55 | * @access protected 56 | */ 57 | protected $allowAnonymous = ['index', 'do-something']; 58 | 59 | // Public Methods 60 | // ========================================================================= 61 | 62 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 63 | /** 64 | * Handle a request going to our module's index action URL, 65 | * e.g.: actions/<%= pluginKebabHandle %>/<%= controllerName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> 66 | * 67 | * @return mixed 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @return mixed 72 | */ 73 | <% } -%> 74 | public function actionIndex() 75 | { 76 | $result = 'Welcome to the <%= controllerName[index] %>Controller actionIndex() method'; 77 | 78 | return $result; 79 | } 80 | 81 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 82 | /** 83 | * Handle a request going to our module's actionDoSomething URL, 84 | * e.g.: actions/<%= pluginKebabHandle %>/<%= controllerName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something 85 | * 86 | * @return mixed 87 | */ 88 | <% } else { -%> 89 | /** 90 | * @return mixed 91 | */ 92 | <% } -%> 93 | public function actionDoSomething() 94 | { 95 | $result = 'Welcome to the <%= controllerName[index] %>Controller actionDoSomething() method'; 96 | 97 | return $result; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/controllers/_Controller.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\controllers; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\web\Controller; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= controllerName[index] %> Controller 21 | * 22 | * Generally speaking, controllers are the middlemen between the front end of 23 | * the CP/website and your plugin’s services. They contain action methods which 24 | * handle individual tasks. 25 | * 26 | * A common pattern used throughout Craft involves a controller action gathering 27 | * post data, saving it on a model, passing the model off to a service, and then 28 | * responding to the request appropriately depending on the service method’s response. 29 | * 30 | * Action methods begin with the prefix “action”, followed by a description of what 31 | * the method does (for example, actionSaveIngredient()). 32 | * 33 | * https://craftcms.com/docs/plugins/controllers 34 | * 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } else { -%> 40 | /** 41 | * @author <%- pluginAuthorName %> 42 | * @package <%= pluginHandle %> 43 | * @since <%= pluginVersion %> 44 | */ 45 | <% } -%> 46 | class <%= controllerName[index] %>Controller extends Controller 47 | { 48 | 49 | // Protected Properties 50 | // ========================================================================= 51 | 52 | /** 53 | * @var bool|array Allows anonymous access to this controller's actions. 54 | * The actions must be in 'kebab-case' 55 | * @access protected 56 | */ 57 | protected $allowAnonymous = ['index', 'do-something']; 58 | 59 | // Public Methods 60 | // ========================================================================= 61 | 62 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 63 | /** 64 | * Handle a request going to our plugin's index action URL, 65 | * e.g.: actions/<%= pluginKebabHandle %>/<%= controllerName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> 66 | * 67 | * @return mixed 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @return mixed 72 | */ 73 | <% } -%> 74 | public function actionIndex() 75 | { 76 | $result = 'Welcome to the <%= controllerName[index] %>Controller actionIndex() method'; 77 | 78 | return $result; 79 | } 80 | 81 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 82 | /** 83 | * Handle a request going to our plugin's actionDoSomething URL, 84 | * e.g.: actions/<%= pluginKebabHandle %>/<%= controllerName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something 85 | * 86 | * @return mixed 87 | */ 88 | <% } else { -%> 89 | /** 90 | * @return mixed 91 | */ 92 | <% } -%> 93 | public function actionDoSomething() 94 | { 95 | $result = 'Welcome to the <%= controllerName[index] %>Controller actionDoSomething() method'; 96 | 97 | return $result; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/assetbundles/widgetresources/dist/img/widget.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/assetbundles/widgetresources/dist/img/widget.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/jobs/_Job.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\jobs; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\queue\BaseJob; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= taskName[index] %> job 21 | * 22 | * Jobs are run in separate process via a Queue of pending jobs. This allows 23 | * you to spin lengthy processing off into a separate PHP process that does not 24 | * block the main process. 25 | * 26 | * You can use it like this: 27 | * 28 | * use modules\<%= pluginDirName %>\jobs\<%= taskName[index] %> as <%= taskName[index] %>Job; 29 | * 30 | * $queue = Craft::$app->getQueue(); 31 | * $jobId = $queue->push(new <%= taskName[index] %>Job([ 32 | * 'description' => Craft::t('<%= pluginDirName %>', 'This overrides the default description'), 33 | * 'someAttribute' => 'someValue', 34 | * ])); 35 | * 36 | * The key/value pairs that you pass in to the job will set the public properties 37 | * for that object. Thus whatever you set 'someAttribute' to will cause the 38 | * public property $someAttribute to be set in the job. 39 | * 40 | * Passing in 'description' is optional, and only if you want to override the default 41 | * description. 42 | * 43 | * More info: https://github.com/yiisoft/yii2-queue 44 | * 45 | * @author <%- pluginAuthorName %> 46 | * @package <%= pluginHandle %> 47 | * @since <%= pluginVersion %> 48 | */ 49 | <% } else { -%> 50 | /** 51 | * @author <%- pluginAuthorName %> 52 | * @package <%= pluginHandle %> 53 | * @since <%= pluginVersion %> 54 | */ 55 | <% } -%> 56 | class <%= taskName[index] %> extends BaseJob 57 | { 58 | // Public Properties 59 | // ========================================================================= 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Some attribute 64 | * 65 | * @var string 66 | */ 67 | <% } else { -%> 68 | /** 69 | * @var string 70 | */ 71 | <% } -%> 72 | public $someAttribute = 'Some Default'; 73 | 74 | // Public Methods 75 | // ========================================================================= 76 | 77 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 78 | /** 79 | * When the Queue is ready to run your job, it will call this method. 80 | * You don't need any steps or any other special logic handling, just do the 81 | * jobs that needs to be done here. 82 | * 83 | * More info: https://github.com/yiisoft/yii2-queue 84 | */ 85 | <% } else { -%> 86 | /** 87 | * @inheritdoc 88 | */ 89 | <% } -%> 90 | public function execute($queue) 91 | { 92 | // Do work here 93 | } 94 | 95 | // Protected Methods 96 | // ========================================================================= 97 | 98 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 99 | /** 100 | * Returns a default description for [[getDescription()]], if [[description]] isn’t set. 101 | * 102 | * @return string The default task description 103 | */ 104 | <% } else { -%> 105 | /** 106 | * @inheritdoc 107 | */ 108 | <% } -%> 109 | protected function defaultDescription(): string 110 | { 111 | return Craft::t('<%= pluginDirName %>', '<%= taskName[index] %>'); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/jobs/_Job.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\jobs; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use craft\queue\BaseJob; 17 | 18 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 19 | /** 20 | * <%= taskName[index] %> job 21 | * 22 | * Jobs are run in separate process via a Queue of pending jobs. This allows 23 | * you to spin lengthy processing off into a separate PHP process that does not 24 | * block the main process. 25 | * 26 | * You can use it like this: 27 | * 28 | * use <%= pluginVendorName %>\<%= pluginDirName %>\jobs\<%= taskName[index] %> as <%= taskName[index] %>Job; 29 | * 30 | * $queue = Craft::$app->getQueue(); 31 | * $jobId = $queue->push(new <%= taskName[index] %>Job([ 32 | * 'description' => Craft::t('<%= pluginKebabHandle %>', 'This overrides the default description'), 33 | * 'someAttribute' => 'someValue', 34 | * ])); 35 | * 36 | * The key/value pairs that you pass in to the job will set the public properties 37 | * for that object. Thus whatever you set 'someAttribute' to will cause the 38 | * public property $someAttribute to be set in the job. 39 | * 40 | * Passing in 'description' is optional, and only if you want to override the default 41 | * description. 42 | * 43 | * More info: https://github.com/yiisoft/yii2-queue 44 | * 45 | * @author <%- pluginAuthorName %> 46 | * @package <%= pluginHandle %> 47 | * @since <%= pluginVersion %> 48 | */ 49 | <% } else { -%> 50 | /** 51 | * @author <%- pluginAuthorName %> 52 | * @package <%= pluginHandle %> 53 | * @since <%= pluginVersion %> 54 | */ 55 | <% } -%> 56 | class <%= taskName[index] %> extends BaseJob 57 | { 58 | // Public Properties 59 | // ========================================================================= 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Some attribute 64 | * 65 | * @var string 66 | */ 67 | <% } else { -%> 68 | /** 69 | * @var string 70 | */ 71 | <% } -%> 72 | public $someAttribute = 'Some Default'; 73 | 74 | // Public Methods 75 | // ========================================================================= 76 | 77 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 78 | /** 79 | * When the Queue is ready to run your job, it will call this method. 80 | * You don't need any steps or any other special logic handling, just do the 81 | * jobs that needs to be done here. 82 | * 83 | * More info: https://github.com/yiisoft/yii2-queue 84 | */ 85 | <% } else { -%> 86 | /** 87 | * @inheritdoc 88 | */ 89 | <% } -%> 90 | public function execute($queue) 91 | { 92 | // Do work here 93 | } 94 | 95 | // Protected Methods 96 | // ========================================================================= 97 | 98 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 99 | /** 100 | * Returns a default description for [[getDescription()]], if [[description]] isn’t set. 101 | * 102 | * @return string The default task description 103 | */ 104 | <% } else { -%> 105 | /** 106 | * @inheritdoc 107 | */ 108 | <% } -%> 109 | protected function defaultDescription(): string 110 | { 111 | return Craft::t('<%= pluginKebabHandle %>', '<%= taskName[index] %>'); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/widgets/_Widget.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= widgetName[index] %> Widget 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Dashboard widgets allow you to display information in the Admin CP Dashboard. Adding new types of widgets to 10 | * the dashboard couldn’t be easier in Craft 11 | * 12 | * https://craftcms.com/docs/plugins/widgets 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | namespace Craft; 23 | class <%= pluginHandle %><%= widgetName[index] %>Widget extends BaseWidget 24 | { 25 | /** 26 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 27 | * Returns the name of the widget name. 28 | * 29 | <% } -%> 30 | * @return mixed 31 | */ 32 | public function getName() 33 | { 34 | return Craft::t('<%= pluginName %><%= widgetName[index] %>'); 35 | } 36 | /** 37 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 38 | * getBodyHtml() does just what it says: it returns your widget’s body HTML. We recommend that you store the 39 | * actual HTML in a template, and load it via craft()->templates->render(). 40 | * 41 | <% } -%> 42 | * @return mixed 43 | */ 44 | public function getBodyHtml() 45 | { 46 | // Include our Javascript & CSS 47 | craft()->templates->includeCssResource('<%= pluginDirName %>/css/widgets/<%= pluginHandle %><%= widgetName[index] %>Widget.css'); 48 | craft()->templates->includeJsResource('<%= pluginDirName %>/js/widgets/<%= pluginHandle %><%= widgetName[index] %>Widget.js'); 49 | /* -- Variables to pass down to our rendered template */ 50 | $variables = array(); 51 | $variables['settings'] = $this->getSettings(); 52 | return craft()->templates->render('<%= pluginDirName %>/widgets/<%= pluginHandle %><%= widgetName[index] %>Widget_Body', $variables); 53 | } 54 | /** 55 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 56 | * Returns how many columns the widget will span in the Admin CP 57 | * 58 | <% } -%> 59 | * @return int 60 | */ 61 | public function getColspan() 62 | { 63 | return 1; 64 | } 65 | /** 66 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 67 | * Defines the attributes that model your Widget's available settings. 68 | * 69 | <% } -%> 70 | * @return array 71 | */ 72 | protected function defineSettings() 73 | { 74 | return array( 75 | 'someSetting' => array(AttributeType::String, 'label' => 'Some Setting', 'default' => ''), 76 | ); 77 | } 78 | /** 79 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 80 | * Returns the HTML that displays your Widget's settings. 81 | * 82 | <% } -%> 83 | * @return mixed 84 | */ 85 | public function getSettingsHtml() 86 | { 87 | 88 | /* -- Variables to pass down to our rendered template */ 89 | 90 | $variables = array(); 91 | $variables['settings'] = $this->getSettings(); 92 | return craft()->templates->render('<%= pluginDirName %>/widgets/<%= pluginHandle %><%= widgetName[index] %>Widget_Settings',$variables); 93 | } 94 | 95 | /** 96 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 97 | * If you need to do any processing on your settings’ post data before they’re saved to the database, you can 98 | * do it with the prepSettings() method: 99 | * 100 | <% } -%> 101 | * @param mixed $settings The Widget's settings 102 | * 103 | * @return mixed 104 | */ 105 | public function prepSettings($settings) 106 | { 107 | 108 | /* -- Modify $settings here... */ 109 | 110 | return $settings; 111 | } 112 | } -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/console/controllers/_Command.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\console\controllers; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use yii\console\Controller; 17 | use yii\helpers\Console; 18 | 19 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 20 | /** 21 | * <%= consolecommandName[index] %> Command 22 | * 23 | * The first line of this class docblock is displayed as the description 24 | * of the Console Command in ./craft help 25 | * 26 | * Craft can be invoked via commandline console by using the `./craft` command 27 | * from the project root. 28 | * 29 | * Console Commands are just controllers that are invoked to handle console 30 | * actions. The segment routing is module-name/controller-name/action-name 31 | * 32 | * The actionIndex() method is what is executed if no sub-commands are supplied, e.g.: 33 | * 34 | * ./craft <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> 35 | * 36 | * Actions must be in 'kebab-case' so actionDoSomething() maps to 'do-something', 37 | * and would be invoked via: 38 | * 39 | * ./craft <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something 40 | * 41 | * @author <%- pluginAuthorName %> 42 | * @package <%= pluginHandle %> 43 | * @since <%= pluginVersion %> 44 | */ 45 | <% } else { -%> 46 | /** 47 | * <%= consolecommandName[index] %> Command 48 | * 49 | * @author <%- pluginAuthorName %> 50 | * @package <%= pluginHandle %> 51 | * @since <%= pluginVersion %> 52 | */ 53 | <% } -%> 54 | class <%= consolecommandName[index] %>Controller extends Controller 55 | { 56 | // Public Methods 57 | // ========================================================================= 58 | 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | /** 61 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> console commands 62 | * 63 | * The first line of this method docblock is displayed as the description 64 | * of the Console Command in ./craft help 65 | * 66 | * @return mixed 67 | */ 68 | <% } else { -%> 69 | /** 70 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> console commands 71 | * 72 | * @return mixed 73 | */ 74 | <% } -%> 75 | public function actionIndex() 76 | { 77 | $result = 'something'; 78 | 79 | echo "Welcome to the console <%= consolecommandName[index] %>Controller actionIndex() method\n"; 80 | 81 | return $result; 82 | } 83 | 84 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 85 | /** 86 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something console commands 87 | * 88 | * The first line of this method docblock is displayed as the description 89 | * of the Console Command in ./craft help 90 | * 91 | * @return mixed 92 | */ 93 | <% } else { -%> 94 | /** 95 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something console commands 96 | * 97 | * @return mixed 98 | */ 99 | <% } -%> 100 | public function actionDoSomething() 101 | { 102 | $result = 'something'; 103 | 104 | echo "Welcome to the console <%= consolecommandName[index] %>Controller actionDoSomething() method\n"; 105 | 106 | return $result; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/fieldtypes/_FieldType.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= fieldName[index] %> FieldType 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Whenever someone creates a new field in Craft, they must specify what type of field it is. The system comes with 10 | * a handful of field types baked in, and we’ve made it extremely easy for plugins to add new ones. 11 | * 12 | * https://craftcms.com/docs/plugins/field-types 13 | * --snip-- 14 | * 15 | <% } -%> 16 | * @author <%= pluginAuthorName %> 17 | * @copyright <%= copyrightNotice %> 18 | * @link <%= pluginAuthorUrl %> 19 | * @package <%= pluginHandle %> 20 | * @since <%= pluginVersion %> 21 | */ 22 | 23 | namespace Craft; 24 | 25 | class <%= pluginHandle %><%= fieldName[index] %>FieldType extends BaseFieldType 26 | { 27 | /** 28 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 29 | * Returns the name of the fieldtype. 30 | * 31 | <% } -%> 32 | * @return mixed 33 | */ 34 | public function getName() 35 | { 36 | return Craft::t('<%= pluginHandle %><%= fieldName[index] %>'); 37 | } 38 | 39 | /** 40 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 41 | * Returns the content attribute config. 42 | * 43 | <% } -%> 44 | * @return mixed 45 | */ 46 | public function defineContentAttribute() 47 | { 48 | return AttributeType::Mixed; 49 | } 50 | 51 | /** 52 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 53 | * Returns the field's input HTML. 54 | * 55 | <% } -%> 56 | * @param string $name 57 | * @param mixed $value 58 | * @return string 59 | */ 60 | public function getInputHtml($name, $value) 61 | { 62 | if (!$value) 63 | $value = new <%= pluginHandle %><%= fieldName[index] %>Model(); 64 | 65 | $id = craft()->templates->formatInputId($name); 66 | $namespacedId = craft()->templates->namespaceInputId($id); 67 | 68 | /* -- Include our Javascript & CSS */ 69 | 70 | craft()->templates->includeCssResource('<%= pluginDirName %>/css/fields/<%= pluginHandle %><%= fieldName[index] %>FieldType.css'); 71 | craft()->templates->includeJsResource('<%= pluginDirName %>/js/fields/<%= pluginHandle %><%= fieldName[index] %>FieldType.js'); 72 | 73 | /* -- Variables to pass down to our field.js */ 74 | 75 | $jsonVars = array( 76 | 'id' => $id, 77 | 'name' => $name, 78 | 'namespace' => $namespacedId, 79 | 'prefix' => craft()->templates->namespaceInputId(""), 80 | ); 81 | 82 | $jsonVars = json_encode($jsonVars); 83 | craft()->templates->includeJs("$('#{$namespacedId}-field').<%= pluginHandle %><%= fieldName[index] %>FieldType(" . $jsonVars . ");"); 84 | 85 | /* -- Variables to pass down to our rendered template */ 86 | 87 | $variables = array( 88 | 'id' => $id, 89 | 'name' => $name, 90 | 'namespaceId' => $namespacedId, 91 | 'values' => $value 92 | ); 93 | 94 | return craft()->templates->render('<%= pluginDirName %>/fields/<%= pluginHandle %><%= fieldName[index] %>FieldType.twig', $variables); 95 | } 96 | 97 | /** 98 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 99 | * Returns the input value as it should be saved to the database. 100 | * 101 | <% } -%> 102 | * @param mixed $value 103 | * @return mixed 104 | */ 105 | public function prepValueFromPost($value) 106 | { 107 | return $value; 108 | } 109 | 110 | /** 111 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 112 | * Prepares the field's value for use. 113 | * 114 | <% } -%> 115 | * @param mixed $value 116 | * @return mixed 117 | */ 118 | public function prepValue($value) 119 | { 120 | return $value; 121 | } 122 | } -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/console/controllers/_Command.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\console\controllers; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | 15 | use Craft; 16 | use yii\console\Controller; 17 | use yii\helpers\Console; 18 | 19 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 20 | /** 21 | * <%= consolecommandName[index] %> Command 22 | * 23 | * The first line of this class docblock is displayed as the description 24 | * of the Console Command in ./craft help 25 | * 26 | * Craft can be invoked via commandline console by using the `./craft` command 27 | * from the project root. 28 | * 29 | * Console Commands are just controllers that are invoked to handle console 30 | * actions. The segment routing is plugin-name/controller-name/action-name 31 | * 32 | * The actionIndex() method is what is executed if no sub-commands are supplied, e.g.: 33 | * 34 | * ./craft <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> 35 | * 36 | * Actions must be in 'kebab-case' so actionDoSomething() maps to 'do-something', 37 | * and would be invoked via: 38 | * 39 | * ./craft <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something 40 | * 41 | * @author <%- pluginAuthorName %> 42 | * @package <%= pluginHandle %> 43 | * @since <%= pluginVersion %> 44 | */ 45 | <% } else { -%> 46 | /** 47 | * <%= consolecommandName[index] %> Command 48 | * 49 | * @author <%- pluginAuthorName %> 50 | * @package <%= pluginHandle %> 51 | * @since <%= pluginVersion %> 52 | */ 53 | <% } -%> 54 | class <%= consolecommandName[index] %>Controller extends Controller 55 | { 56 | // Public Methods 57 | // ========================================================================= 58 | 59 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 60 | /** 61 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> console commands 62 | * 63 | * The first line of this method docblock is displayed as the description 64 | * of the Console Command in ./craft help 65 | * 66 | * @return mixed 67 | */ 68 | <% } else { -%> 69 | /** 70 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %> console commands 71 | * 72 | * @return mixed 73 | */ 74 | <% } -%> 75 | public function actionIndex() 76 | { 77 | $result = 'something'; 78 | 79 | echo "Welcome to the console <%= consolecommandName[index] %>Controller actionIndex() method\n"; 80 | 81 | return $result; 82 | } 83 | 84 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 85 | /** 86 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something console commands 87 | * 88 | * The first line of this method docblock is displayed as the description 89 | * of the Console Command in ./craft help 90 | * 91 | * @return mixed 92 | */ 93 | <% } else { -%> 94 | /** 95 | * Handle <%= pluginKebabHandle %>/<%= consolecommandName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>/do-something console commands 96 | * 97 | * @return mixed 98 | */ 99 | <% } -%> 100 | public function actionDoSomething() 101 | { 102 | $result = 'something'; 103 | 104 | echo "Welcome to the console <%= consolecommandName[index] %>Controller actionDoSomething() method\n"; 105 | 106 | return $result; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /app/templates/module_api_version_3_0/src/utilities/_Utility.php: -------------------------------------------------------------------------------- 1 | module for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace modules\<%= pluginDirName %>\utilities; 12 | 13 | use modules\<%= pluginDirName%>\<%= pluginHandle %>; 14 | use modules\<%= pluginDirName %>\assetbundles\<%= utilityName[index].toLowerCase() %>utility\<%= utilityName[index] %>UtilityAsset; 15 | 16 | use Craft; 17 | use craft\base\Utility; 18 | 19 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 20 | /** 21 | * <%- pluginName %> Utility 22 | * 23 | * Utility is the base class for classes representing Control Panel utilities. 24 | * 25 | * https://craftcms.com/docs/plugins/utilities 26 | * 27 | * @author <%- pluginAuthorName %> 28 | * @package <%= pluginHandle %> 29 | * @since <%= pluginVersion %> 30 | */ 31 | <% } else { -%> 32 | /** 33 | * <%- pluginName %> Utility 34 | * 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } -%> 40 | class <%= utilityName[index] %> extends Utility 41 | { 42 | // Static 43 | // ========================================================================= 44 | 45 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 46 | /** 47 | * Returns the display name of this utility. 48 | * 49 | * @return string The display name of this utility. 50 | */ 51 | <% } else { -%> 52 | /** 53 | * @inheritdoc 54 | */ 55 | <% } -%> 56 | public static function displayName(): string 57 | { 58 | return Craft::t('<%= pluginKebabHandle %>', '<%= utilityName[index] %>'); 59 | } 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Returns the utility’s unique identifier. 64 | * 65 | * The ID should be in `kebab-case`, as it will be visible in the URL (`admin/utilities/the-handle`). 66 | * 67 | * @return string 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @inheritdoc 72 | */ 73 | <% } -%> 74 | public static function id(): string 75 | { 76 | return '<%= pluginDirName %>-<%= utilityName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>'; 77 | } 78 | 79 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 80 | /** 81 | * Returns the path to the utility's SVG icon. 82 | * 83 | * @return string|null The path to the utility SVG icon 84 | */ 85 | <% } else { -%> 86 | /** 87 | * @inheritdoc 88 | */ 89 | <% } -%> 90 | public static function iconPath() 91 | { 92 | return Craft::getAlias("@modules/<%= pluginDirName %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist/img/<%= utilityName[index] %>-icon.svg"); 93 | } 94 | 95 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 96 | /** 97 | * Returns the number that should be shown in the utility’s nav item badge. 98 | * 99 | * If `0` is returned, no badge will be shown 100 | * 101 | * @return int 102 | */ 103 | <% } else { -%> 104 | /** 105 | * @inheritdoc 106 | */ 107 | <% } -%> 108 | public static function badgeCount(): int 109 | { 110 | return 0; 111 | } 112 | 113 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 114 | /** 115 | * Returns the utility's content HTML. 116 | * 117 | * @return string 118 | */ 119 | <% } else { -%> 120 | /** 121 | * @inheritdoc 122 | */ 123 | <% } -%> 124 | public static function contentHtml(): string 125 | { 126 | Craft::$app->getView()->registerAssetBundle(<%= utilityName[index] %>UtilityAsset::class); 127 | 128 | $someVar = 'Have a nice day!'; 129 | return Craft::$app->getView()->renderTemplate( 130 | '<%= pluginKebabHandle %>/_components/utilities/<%= utilityName[index] %>_content', 131 | [ 132 | 'someVar' => $someVar 133 | ] 134 | ); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /app/templates/api_version_3_0/src/utilities/_Utility.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 3.x 4 | * 5 | * <%- pluginDescription %> 6 | * 7 | * @link <%= pluginAuthorUrl %> 8 | * @copyright <%- copyrightNotice %> 9 | */ 10 | 11 | namespace <%= pluginVendorName %>\<%= pluginDirName %>\utilities; 12 | 13 | use <%= pluginVendorName %>\<%= pluginDirName%>\<%= pluginHandle %>; 14 | use <%= pluginVendorName %>\<%= pluginDirName %>\assetbundles\<%= utilityName[index].toLowerCase() %>utility\<%= utilityName[index] %>UtilityAsset; 15 | 16 | use Craft; 17 | use craft\base\Utility; 18 | 19 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 20 | /** 21 | * <%- pluginName %> Utility 22 | * 23 | * Utility is the base class for classes representing Control Panel utilities. 24 | * 25 | * https://craftcms.com/docs/plugins/utilities 26 | * 27 | * @author <%- pluginAuthorName %> 28 | * @package <%= pluginHandle %> 29 | * @since <%= pluginVersion %> 30 | */ 31 | <% } else { -%> 32 | /** 33 | * <%- pluginName %> Utility 34 | * 35 | * @author <%- pluginAuthorName %> 36 | * @package <%= pluginHandle %> 37 | * @since <%= pluginVersion %> 38 | */ 39 | <% } -%> 40 | class <%= utilityName[index] %> extends Utility 41 | { 42 | // Static 43 | // ========================================================================= 44 | 45 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 46 | /** 47 | * Returns the display name of this utility. 48 | * 49 | * @return string The display name of this utility. 50 | */ 51 | <% } else { -%> 52 | /** 53 | * @inheritdoc 54 | */ 55 | <% } -%> 56 | public static function displayName(): string 57 | { 58 | return Craft::t('<%= pluginKebabHandle %>', '<%= utilityName[index] %>'); 59 | } 60 | 61 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 62 | /** 63 | * Returns the utility’s unique identifier. 64 | * 65 | * The ID should be in `kebab-case`, as it will be visible in the URL (`admin/utilities/the-handle`). 66 | * 67 | * @return string 68 | */ 69 | <% } else { -%> 70 | /** 71 | * @inheritdoc 72 | */ 73 | <% } -%> 74 | public static function id(): string 75 | { 76 | return '<%= pluginDirName %>-<%= utilityName[index].replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}).slice(1) %>'; 77 | } 78 | 79 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 80 | /** 81 | * Returns the path to the utility's SVG icon. 82 | * 83 | * @return string|null The path to the utility SVG icon 84 | */ 85 | <% } else { -%> 86 | /** 87 | * @inheritdoc 88 | */ 89 | <% } -%> 90 | public static function iconPath() 91 | { 92 | return Craft::getAlias("@<%= pluginVendorName %>/<%= pluginDirName %>/assetbundles/<%= utilityName[index].toLowerCase() %>utility/dist/img/<%= utilityName[index] %>-icon.svg"); 93 | } 94 | 95 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 96 | /** 97 | * Returns the number that should be shown in the utility’s nav item badge. 98 | * 99 | * If `0` is returned, no badge will be shown 100 | * 101 | * @return int 102 | */ 103 | <% } else { -%> 104 | /** 105 | * @inheritdoc 106 | */ 107 | <% } -%> 108 | public static function badgeCount(): int 109 | { 110 | return 0; 111 | } 112 | 113 | <% if ((typeof codeComments !== 'undefined') && (codeComments)) { -%> 114 | /** 115 | * Returns the utility's content HTML. 116 | * 117 | * @return string 118 | */ 119 | <% } else { -%> 120 | /** 121 | * @inheritdoc 122 | */ 123 | <% } -%> 124 | public static function contentHtml(): string 125 | { 126 | Craft::$app->getView()->registerAssetBundle(<%= utilityName[index] %>UtilityAsset::class); 127 | 128 | $someVar = 'Have a nice day!'; 129 | return Craft::$app->getView()->renderTemplate( 130 | '<%= pluginKebabHandle %>/_components/utilities/<%= utilityName[index] %>_content', 131 | [ 132 | 'someVar' => $someVar 133 | ] 134 | ); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /app/templates/api_version_2_5/elementtypes/_ElementType.php: -------------------------------------------------------------------------------- 1 | plugin for Craft CMS 4 | * 5 | * <%= pluginHandle %><%= elementName[index] %> ElementType 6 | * 7 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 8 | * --snip-- 9 | * Element Types are the classes used to identify each of these types of elements in Craft. There’s a 10 | * “UserElementType”, there’s an “AssetElementType”, and so on. If you’ve ever developed a custom Field Type class 11 | * before, this should sound familiar. The relationship between an element and an Element Type is the same as that 12 | * between a field and a Field Type. 13 | * 14 | * http://pixelandtonic.com/blog/craft-element-types 15 | * --snip-- 16 | * 17 | <% } -%> 18 | * @author <%= pluginAuthorName %> 19 | * @copyright <%= copyrightNotice %> 20 | * @link <%= pluginAuthorUrl %> 21 | * @package <%= pluginHandle %> 22 | * @since <%= pluginVersion %> 23 | */ 24 | 25 | namespace Craft; 26 | 27 | class <%= pluginHandle %><%= elementName[index] %>ElementType extends BaseElementType 28 | { 29 | /** 30 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 31 | * Returns this element type's name. 32 | * 33 | <% } -%> 34 | * @return mixed 35 | */ 36 | public function getName() 37 | { 38 | return Craft::t('<%= pluginHandle %><%= elementName[index] %>'); 39 | } 40 | 41 | /** 42 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 43 | * Returns whether this element type has content. 44 | * 45 | <% } -%> 46 | * @return bool 47 | */ 48 | public function hasContent() 49 | { 50 | return true; 51 | } 52 | 53 | /** 54 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 55 | * Returns whether this element type has titles. 56 | * 57 | <% } -%> 58 | * @return bool 59 | */ 60 | public function hasTitles() 61 | { 62 | return true; 63 | } 64 | 65 | /** 66 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 67 | * Returns whether this element type can have statuses. 68 | * 69 | <% } -%> 70 | * @return bool 71 | */ 72 | public function hasStatuses() 73 | { 74 | return true; 75 | } 76 | 77 | /** 78 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 79 | * Returns whether this element type is localized. 80 | * 81 | <% } -%> 82 | * @return bool 83 | */ 84 | public function isLocalized() 85 | { 86 | return false; 87 | } 88 | 89 | /** 90 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 91 | * Returns this element type's sources. 92 | * 93 | <% } -%> 94 | * @param string|null $context 95 | * @return array|false 96 | */ 97 | public function getSources($context = null) 98 | { 99 | } 100 | 101 | /** 102 | * @inheritDoc IElementType::getAvailableActions() 103 | * 104 | * @param string|null $source 105 | * 106 | * @return array|null 107 | */ 108 | public function getAvailableActions($source = null) 109 | { 110 | } 111 | 112 | /** 113 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 114 | * Returns the attributes that can be shown/sorted by in table views. 115 | * 116 | <% } -%> 117 | * @param string|null $source 118 | * @return array 119 | */ 120 | public function defineTableAttributes($source = null) 121 | { 122 | } 123 | 124 | /** 125 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 126 | * Returns the table view HTML for a given attribute. 127 | * 128 | <% } -%> 129 | * @param BaseElementModel $element 130 | * @param string $attribute 131 | * @return string 132 | */ 133 | public function getTableAttributeHtml(BaseElementModel $element, $attribute) 134 | { 135 | } 136 | 137 | /** 138 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 139 | * Defines any custom element criteria attributes for this element type. 140 | * 141 | <% } -%> 142 | * @return array 143 | */ 144 | public function defineCriteriaAttributes() 145 | { 146 | } 147 | 148 | /** 149 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 150 | * Modifies an element query targeting elements of this type. 151 | * 152 | <% } -%> 153 | * @param DbCommand $query 154 | * @param ElementCriteriaModel $criteria 155 | * @return mixed 156 | */ 157 | public function modifyElementsQuery(DbCommand $query, ElementCriteriaModel $criteria) 158 | { 159 | } 160 | 161 | /** 162 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 163 | * Populates an element model based on a query result. 164 | * 165 | <% } -%> 166 | * @param array $row 167 | * @return array 168 | */ 169 | public function populateElementModel($row) 170 | { 171 | } 172 | 173 | /** 174 | <% if ((typeof codeComments !== 'undefined') && (codeComments)){ -%> 175 | * Returns the HTML for an editor HUD for the given element. 176 | * 177 | <% } -%> 178 | * @param BaseElementModel $element 179 | * @return string 180 | */ 181 | public function getEditorHtml(BaseElementModel $element) 182 | { 183 | } 184 | } --------------------------------------------------------------------------------