# Plugin-DEV \> Do i have to "register" my new controller ... or what else could be wrong?

**URL:** <https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098>\
**Category:** Plugins\
**Created:** [March 24, 2020, 7:37am UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098 "2020-03-24T07:37:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manne65-hd](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/manne65-hd/32/561_2.png) [@manne65-hd](https://kanboard.discourse.group/u/manne65-hd)\
**Post date:** [March 24, 2020, 7:37am UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/1 "2020-03-24T07:37:12Z")

</div>

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](https://github.com/manne65-hd/Kanboard-DuplicateTaskOptions)

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_

 ![ControllerNotFound-MODAL](https://global.discourse-cdn.com/free1/uploads/kanboard1/original/1X/8e2ca8295b99f438aad41c44d423c2b8608745e6.png)

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.

---

<div class="post-metadata">

**Author:** ![BlueTeck](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/blueteck/32/519_2.png) [@BlueTeck](https://kanboard.discourse.group/u/BlueTeck)\
**Post date:** [March 24, 2020, 9:13am UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/2 "2020-03-24T09:13:19Z")

</div>

Hey,  
the link to your controller should include a plugin parameter.

e.g.: [https://github.com/BlueTeck/kanboard\_plugin\_coverimage/blob/master/Template/task\_file/images.php#L8](https://github.com/BlueTeck/kanboard_plugin_coverimage/blob/master/Template/task_file/images.php#L8)

Regards,  
Timo

---

<div class="post-metadata">

**Author:** ![manne65-hd](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/manne65-hd/32/561_2.png) [@manne65-hd](https://kanboard.discourse.group/u/manne65-hd)\
**Post date:** [March 24, 2020, 10:59am UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/3 "2020-03-24T10:59:50Z")

</div>

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 😐

---

<div class="post-metadata">

**Author:** ![BlueTeck](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/blueteck/32/519_2.png) [@BlueTeck](https://kanboard.discourse.group/u/BlueTeck)\
**Post date:** [March 24, 2020, 11:35am UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/4 "2020-03-24T11:35:54Z")

</div>

Your Controller is named DuplicateTaskOptions but you tried to open DuplicateTaskOptionsController

> <https://github.com/manne65-hd/Kanboard-DuplicateTaskOptions/blob/master/Controller/DuplicateTaskOptionsController.php#L14>

---

<div class="post-metadata">

**Author:** ![manne65-hd](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/manne65-hd/32/561_2.png) [@manne65-hd](https://kanboard.discourse.group/u/manne65-hd)\
**Post date:** [March 24, 2020, 12:02pm UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/5 "2020-03-24T12:02:51Z")

</div>

/me [slaps myself in the face with a large trout](https://www.youtube.com/watch?v=tWe3mbHxJ3I) 🤪

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 🙂

---

<div class="post-metadata">

**Author:** ![BlueTeck](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/blueteck/32/519_2.png) [@BlueTeck](https://kanboard.discourse.group/u/BlueTeck)\
**Post date:** [March 24, 2020, 12:19pm UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/6 "2020-03-24T12:19:20Z")

</div>

Everybody has some slappy fish moments 😉

> [@manne65-hd](#):
>
> $this-\>template-\>hook-\>attach(‘template:task\_duplication:copy\_options’, ‘DuplicateTaskOptions:task\_duplication/copy\_options’);

Try to make DuplicateTaskOptions all lowercase in hooks-

---

<div class="post-metadata">

**Author:** ![manne65-hd](https://yyz2.discourse-cdn.com/free1/user_avatar/kanboard.discourse.group/manne65-hd/32/561_2.png) [@manne65-hd](https://kanboard.discourse.group/u/manne65-hd)\
**Post date:** [March 24, 2020, 2:05pm UTC](https://kanboard.discourse.group/t/plugin-dev-do-i-have-to-register-my-new-controller-or-what-else-could-be-wrong/1098/7 "2020-03-24T14:05:17Z")

</div>

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 🙂
