This plugin does not currently include all the services offered by tarteaucitron.js, any contribution is therefore welcome.
For development purposes, because of assets live compilation, the best way to handle plugin in your Craft project is to create a symlink to this folder.
Add this in the composer.json
of your Craft project.
{
"repositories": [
{
"type": "path",
"url": "/path/to/your/craft-tarteaucitron",
"options": {
"symlink": true
}
}
],
"require": {
"la-haute-societe/craft-tarteaucitron": "dev-master"
}
}
All sources are located in the resources
folder in the plugin root folder.
To build assets, run these commands from the plugin root folder :
npm install # Install node dependencies needed for building assets
npm run watch # Build assets in development mode & watch them for changes
npm run dev # Build assets in development mode
npm run build # Build assets in production mode
git submodule init
git submodule update
npm gulp js css
Several steps are required to add a tarteaucitron.js service into the plugin.
- Implements service settings template in
src/templates/settings/services
- Include it in
src/templates/settings/settings.twig
- Declare parameters & validation rules in
src/models/SettingsModel.php
- Load CodeMirror style for your settings in
resources/js/models/Settings.js
andresources/scss/pages/_settings.scss
- Define a service model in
src/models/services
- Create a plugin rendering function in
src/services/TarteaucitronService.php
- Define a Craft variable method to render the service in your templates in
src/variables/TarteaucitronVariable.php