I created a plugin that registers contacts made within a task. The plugin loads the form and saves the data into the database.
The issue is that I am unable to configure the plugin’s route to load the list of contacts saved in the database within the task view.
Below is the Plugin.php file.
<?php
namespace Kanboard\Plugin\ContactInfo;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
class Plugin extends Base
{
public function initialize()
{
// $this->route->addRoute('/contact-info', 'ContactInfoController', 'show', 'ContactInfo');
$this->route->addRoute('/task/:task_id/contact-info', 'ContactInfoController', 'show', 'ContactInfo');
// Hook para adicionar o formulário de contato
// $this->template->hook->attach('template:task:sidebar:information', 'ContactInfo:task/contact_info', array());
// Hook para listar os contatos
$this->template->hook->attach('template:task:details:bottom', 'ContactInfo:task/contact_info');
$this->template->hook->attach('template:task:details:bottom', 'ContactInfo:task/contact_info_list');
}
public function getClasses()
{
return array(
'Plugin\ContactInfo\Controller' => array(
'ContactInfoController',
),
'Plugin\ContactInfo\Model' => array(
'ContactInfoModel',
),
);
}
public function getPluginName()
{
return 'ContactInfo';
}
public function getPluginDescription()
{
return t('Plugin para gerenciar informações de contato nas tarefas.');
}
public function getPluginAuthor()
{
return 'Seu Nome';
}
public function getPluginVersion()
{
return '1.0.0';
}
public function getPluginHomepage()
{
return 'http://seusite.com';
}
}
I’m sorry, but I still don’t understand the logic of your plugin.
It’s relatively weird, I think it is not legit or useful to add a form to the task detail page.
You should invoke it from the sidebar.
I hope I’m not too harsh, but
may I suggest you get familiar with the Kanboard internals regarding plugin development first. There are many plugins around to study how things can be done in a compatible way.
Then please publish your work on any git platform, so that others really can support you with your issues. Studying code within the forum is not a pleasure.
You were not rude, and I appreciate the time you took to try to help me. First of all, I want you to know that I searched the documentation to understand how the plugin works, but what I was looking for wasn’t mentioned there. That’s why I sought help here in the forum.
My intention was to do something different from the usual. A very popular saying in my country goes: “For those with strong minds, the impossible is just a matter of opinion.”
As you can see in the image below, I managed to introduce what I wanted within the task view. This way, I make it easier for the user to register and view the contacts made without having to leave the view or go to another screen for that.
Once again, I appreciate the time you took to try to help me. Big hug.