definitely possible. what part do you need help with? take a few moments to read the docs pertaining to plugin development, and then check out some plugins out there which add to the schema or utilize metadata. that should help provide enough information to then ask questions.
Thanks for the quick reply.
Your hints helped me out.
I took a look at the documentation again and also inspected some plugins and found out:
- how to alter the columns table (Plugin Schema Migration)
- how to change the frontend (Template Override)
So… I now have my new custom field in the database and in my frontend. So far so good.
Whats still missing is the Model / Controller. I identified the methods in the code:
->getAllWithTaskCount (for the view project->columns)
->create (for the create dialog)
->save (for the create dialog)
I can change the source code of the main application and it works… but sadly I still dont understand how to alter these parts through my plugin.
How can i override these methods?
Can i use hooks for that? If so where can I find the name of the hooks and how would i got about it?
I understand that its also possible to add custom fields using hooks… but i didnt quite understand how to do it for the column template. For example Template/Column/index.php.
Im using Template Override for now but it feels like hooks are the way to go? (Template Hooks?)
But … looking at the list of template hooks… I could not find the hooks for the columns (index & create): https://docs.kanboard.org/en/latest/plugins/hooks.html#template-hooks
You could do either, however, to use a hook, which doesn’t exist, would require you adding the hook to the core through a PR (or if its just you, add it to your core code to connect to it). A couple things to note, when a plugin overrides a model, in the event that 2 plugins are being used, and both override the same model, there will be an issue, as only 1 model will be overriden(unless you account for that in your code, you can see the accountabilities in plugin examples such as MetaMagik and Group_assign), if its just for you, I would simply override it. Personally, it could be argued both ways as to which is the best approach, if the hook exists, definitely use it, but if you have to make a PR to add a hook, then you have no backwards compatibility until its added. I have no qualms overriding anything.
Controllers do not necessarily need to be, “overridden”, just called. So, you need to figure out how to call your controller, instead of the previous one. Generally, controllers are called in a template, so in this instance, using a hook won’t work for you, you will need to override the template to call your controller instead. I will continue to use MetaMagik as an example here:
Calling these controllers:
The main thing to notice here, is the array when calling them, includes 'plugin' => 'MetaMagik'
And the namespaces of the controllers.
and yes, if the template you override is updated in kanboards main code, it would be appropriate to update yours as well. It’s something that happens, and something to consider, I haven’t experienced many of these, and generally don’t even notice unless someone points it out on my issue pages.