Adding custom fields to project page

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
Mophilly
Posts: 55
Joined: 24 Feb 2005, 23:47
Location: California
Contact:

Adding custom fields to project page

Post 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?
cas
Posts: 982
Joined: 11 Mar 2006, 16:08
Contact:

Re: Adding custom fields to project page

Post 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.
Mophilly
Posts: 55
Joined: 24 Feb 2005, 23:47
Location: California
Contact:

Re: Adding custom fields to project page

Post 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.
cas
Posts: 982
Joined: 11 Mar 2006, 16:08
Contact:

Re: Adding custom fields to project page

Post 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:
Mophilly
Posts: 55
Joined: 24 Feb 2005, 23:47
Location: California
Contact:

Re: Adding custom fields to project page

Post 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?
cas
Posts: 982
Joined: 11 Mar 2006, 16:08
Contact:

Re: Adding custom fields to project page

Post 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
Mophilly
Posts: 55
Joined: 24 Feb 2005, 23:47
Location: California
Contact:

Re: Adding custom fields to project page

Post by Mophilly »

Found it in developer documentation. Thank you!
ErikA
Posts: 4
Joined: 22 Jul 2014, 14:09

Re: Adding custom fields to project page

Post 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 );
Post Reply