Hi there kanboard-community,
please bear with me if my question sounds “stupid”, but I still have much more experience in procedural-PHP-coding than in modern OOP-style. Due to the corona-shutdown I hopefully now have the opportunity to change that
Now for my question:
I am trying to develop a plugin, that will offer extended options when duplicating a task. So I took the TaskDuplicationController and tried to extend it with my own class DuplicateTaskOptions and made some basic changes to it including adding a copy of the original template for the copy-method.
You can take a look at my code here
When I try to call my new controller from the newly added option from task-dropdown or task-sidebar … a modal window appears giving me an Internal Error: Controller not found
So it seems like I need to do more in order to be able to use my new controller?
Can anyone point me in the right direction?
Looking forward to your answers,
Manfred.
Hey,
so I changed my /Template/task/dropdown.php to this:
<?php if ($this->projectRole->canUpdateTask($task)): ?>
<li>
<?= $this->modal->small('object-group', t('Duplicate task with options ...'), 'DuplicateTaskOptionsController', 'copyOptions', array('plugin' => 'DuplicateTaskOptions', 'task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php endif ?>
I also tried
- array(‘plugin’ => ‘duplicateTaskOptions’ …
- array(‘plugin’ => ‘duplicatetaskoptions’ …
Still the same error
Your Controller is named DuplicateTaskOptions but you tried to open DuplicateTaskOptionsController
1 Like
/me slaps myself in the face with a large trout
Now it looks like I have to “tell” Kanboard where to find my new template, because it seems to search for it in the app/core/ -folder
include(C:\xampp\htdocs\VirtualHosts\kanboard\coding\root\app\Core\..\Template\task_duplication/copy_options.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\VirtualHosts\kanboard\coding\root\app\Core\Template.php on line 83
This new line in my plugin.php @ function initialize() doesn’t seem to do the job:
$this->template->hook->attach('template:task_duplication:copy_options', 'DuplicateTaskOptions:task_duplication/copy_options');
Thanks for your help so far
Everybody has some slappy fish moments
Try to make DuplicateTaskOptions all lowercase in hooks-
Are you talking about changing it to?
$this->template->hook->attach('template:task_duplication:copy_options', 'duplicatetaskoptions:task_duplication/copy_options');
That doesn’t change the problem.
I changed line 44 of DuplicateTaskOptionsController.php as follows, and then it shows the standard Duplicate the task to another project-dialog
return $this->chooseOptions($task, 'task_duplication/copy');
Maybe I need to use another way of “registering” my template, because there is nothing like “copy_options” in the orginal TaskDuplicationController ??
I’m sorry … but most of the code in Kanboard is still a big mystery for me because I still have very little knowledge with OOP and all these tons of classes, hooks, etc.make me a bit dizzy …
Anyway I am willing and hopefully able to learn