Page 1 of 1

Adding custom fields to project page

Posted: 23 Sep 2020, 14:40
by Mophilly
We have a need to add a couple of fields to the project definition page. We feel it would be best not to hack the core code. Better to add a new feature similar to the custom fields for issues.

Is there support for this in MantisBT?

Has anyone discussed adding "custom fields" to the project definition page?

Re: Adding custom fields to project page

Posted: 23 Sep 2020, 14:49
by cas
That is currently not available, you would need a plugin for that ( not sure if one already exists). There is an event available within the project script.

Re: Adding custom fields to project page

Posted: 23 Sep 2020, 17:21
by Mophilly
It has been a while since I poked around in the code. I leave that to Andy mostly. However, I want to outline this idea before handing off.

I checked out the files at github that contain the word "proj" and "project" but came up no smarter than when I started.

I would be grateful for a hint of where to look.

Re: Adding custom fields to project page

Posted: 24 Sep 2020, 07:52
by cas
Not sure what fields you would like to add but have a look here:
https://github.com/vincentsels/ProjectManagement
Now this plugin is pretty old and not suitable for version 2x but at least gives you an idea :mrgreen:

Re: Adding custom fields to project page

Posted: 24 Sep 2020, 15:31
by Mophilly
Thanks. At first glance, that plugin is bit more than what I have in mind. I will download the code and have a look at it.

I was trying find the "event" that might trigger the building of the project page under management. Is there a document that offers insight into the MantisBT architecture?

Re: Adding custom fields to project page

Posted: 24 Sep 2020, 15:39
by cas
Events are simply places in the code where custom plugin code will be called. There is a wiki on the plug-in functionality

Re: Adding custom fields to project page

Posted: 24 Sep 2020, 22:19
by Mophilly
Found it in developer documentation. Thank you!

Re: Adding custom fields to project page

Posted: 27 Nov 2020, 10:13
by ErikA
We use the default custom_fields for this.
However, there is indeed no built-in way to have MantisBT add these custom_fields by default when you create a new project. Which I don't understand, at least project should inherit custom_fields from their parents, but hey.

You can add below code in 'manage_create_proj.php', after the if( 0 != $f_parent_id ) clause, before the first event_signal, for every custom_field you want to use by default when creating new projects:

/* id = 1: custom field named f.e. 'environment' */
custom_field_link( 1, $t_project_id );
custom_field_set_sequence( 1, $t_project_id, 0 );