Improve Automatic Actions plugin api
This commit is contained in:
@@ -138,40 +138,3 @@ $this->on('app.bootstrap', function($container) {
|
||||
|
||||
- The first argument is the event name
|
||||
- The second argument is a PHP callable function (closure or class method)
|
||||
|
||||
Extend Automatic Actions
|
||||
------------------------
|
||||
|
||||
To define a new automatic action with a plugin, you just need to call the method `extendActions()` from the class `Kanboard\Model\Action`, here an example:
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Plugin\AutomaticAction;
|
||||
|
||||
use Kanboard\Core\Plugin\Base;
|
||||
|
||||
class Plugin extends Base
|
||||
{
|
||||
public function initialize()
|
||||
{
|
||||
$this->action->extendActions(
|
||||
'\Kanboard\Plugin\AutomaticAction\Action\DoSomething', // Use absolute namespace
|
||||
t('Do something when the task color change')
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- The first argument of the method `extendActions()` is the action class with the complete namespace path. **The namespace path must starts with a backslash** otherwise Kanboard will not be able to load your class.
|
||||
- The second argument is the description of your automatic action.
|
||||
|
||||
The automatic action class must inherit from the class `Kanboard\Action\Base` and implements all abstract methods:
|
||||
|
||||
- `getCompatibleEvents()`
|
||||
- `getActionRequiredParameters()`
|
||||
- `getEventRequiredParameters()`
|
||||
- `doAction(array $data)`
|
||||
- `hasRequiredCondition(array $data)`
|
||||
|
||||
For more details you should take a look to existing automatic actions or this [plugin example](https://github.com/kanboard/plugin-example-automatic-action).
|
||||
|
||||
Reference in New Issue
Block a user