assets
7 years ago
admin-ui.md
7 years ago
how-to-add-new-addon.md
7 years ago
how-to-block-cookies.md
7 years ago
how-to-add-new-addon.md
35 lines
| 1 | # How to add new addon |
| 2 | |
| 3 | Steps |
| 4 | --- |
| 5 | |
| 6 | 1. Add new addon to addons.json |
| 7 | 2. Create a directory in addons/controller/addons |
| 8 | 3. Create a class in that new directory (copy class from another addon and adjust the namespace, classname and methods.) |
| 9 | 4. Edit 'load_configuration' method. That is the only method that needs to be worked on to block the cookies. You can create your own method from there. |
| 10 | 5. Test |
| 11 | 6. Create integration test if you did use dependencies from the addon plugin. (We run daily tests to see if the dependencies from the addons plugin are still valid.) |
| 12 | 7. Send a pull-request in github |
| 13 | |
| 14 | Example |
| 15 | --- |
| 16 | 1. New addon to addons.json |
| 17 | |
| 18 | ```json |
| 19 | "Add_To_Any": { |
| 20 | "class": "cookiebot_addons\\controller\\addons\\add_to_any\\Add_To_Any" |
| 21 | }, |
| 22 | ``` |
| 23 | |
| 24 | 2. Create directory 'add_to_any' in controller/addons |
| 25 | |
| 26 | 3. Create a class 'Add_To_Any' in 'add_to_any' directory (copy class from another addon and rename everything accordingly) |
| 27 | |
| 28 | 5. Go to 'load_configuration' method and rename the callback function to make it give more sense. Write your cookie-blocking logic in that function. You can find more information about how to block cookies in [how-to-block-cookies](how-to-block-cookies.md). |
| 29 | |
| 30 | 6. Test if the cookies are blocked. |
| 31 | |
| 32 | 7. Create integration test for the addon dependencies: https://github.com/CybotAS/CookiebotAddons/blob/develop/tests/integration/addons/test-add-to-any.php |
| 33 | |
| 34 | 8. Send a pull-request to our github repository. |
| 35 |