I'm looking to integrate tasks into a plugin I'm building. Whilst I know that the Craft documentation shows the Tasks Service/Model properties/methods in the full class reference, I can't find anything online about best practices regarding using tasks in plugins. Has anyone come across any articles about creating your own tasks?
1 Answer
I'm not aware of any articles or best practice documents.
There is a sample/simple PowerNap plugin that shows the basics of creating and running a task as well as the TaskService class reference documentation which you've already found.
-
One other headache I had when creating a task for a custom plugin - make sure you name the file/class for your task to be prefixed with the plugin name (which is a standard Craft convention). Something like
MyPlugin_BeAwesomeTask.php
. Commented Aug 30, 2015 at 16:51