Adding new events

Hi, I want to develop an automatic action that can move a task when all subtasks of it are completed. But the application events are not work. The SubtaskModel::EVENT_CREATE_UPDATE only work when edit it.

Then I try to register the new event as the help docs said.

return array(
            $this->actionManager->getAction('\Kanboard\Plugin\SubtaskCompleteAutoAction\TaskMoveColumnSubtaskComplete')->addEvent('EVENT_SUBTASKS_COMPLETE', 'All subtasks of a task are completed'),
        );

But how could it work like other existing events? What else code should I add? Can anyone give me some help? Thanks.

1 Like

Did you register your event in OnStartup()?

$this->eventManager->register('EVENT_SUBTASKS_COMPLETE', t(‘All subtasks of a task are completed’));

BTW, I don’t know if this would work in practice. But you can add your event in your actions getCompatibleEvents().

1 Like

Hi, I’m sorry I just saw your reply now. I’ll give it a try.

1 Like