Hidden project template

I have recurring projects that use the same template of tasks (employee onboarding).

What I am looking for is to create a project template that is only visible in the “Create from another project” dropdown when creating a new project.

Is there a way to do this? If so, how can this be done?

1 Like

I haven’t tested, but I’ll assume you have, closed projects don’t show up in the drop-down.

But, I know they are duplicatable. So you just need to add closed projects to your dropdown, so they would be hidden and be in the drop down. If you don’t want ALL closed projects in that dropdown, you could write the code to be specific, and only allow that particular one to show up while closed.

Thank you very much for your reply. Yes, I have tested that. The closed projects do not show up in that drop down.

I’m having difficulty finding the code to modify to pull that single closed project.

In the controller it is grabbing the list from a model, I don’t recommend just changing the models code, instead, add a model and change the controller to grab the list from your new model. It will be easier to edit the base code, but this can be made into a plug in as well, just a bit more work.

Of course I just had a brain epiphany and all you really need to do is add your project ID number and whatever you want to call it into that array just like Do Not Duplicate anything.

i.e.

    $projects_list = array(0 => t('Do not duplicate anything'), 11 => t('My Project Template')) + $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());

11 being your project number.

And I just tested it, and that works with the project being closed.

Awesome!!! Thank you so much. That worked like a charm.

Glad I could help.

With it being that easy, you could just add it to the $project_list array before it builds the dropdown in the template, and then override that template, which would make for a simple plugin and prevent you from having to edit the basecode everytime you upgrade, there might even be a hook there.

@kwpr would you like to collaborate on making that a plugin, or have you maybe done so already? I have the exact same need (employee onboarding), and so I have the same issue you do.

1 Like