Print as PDF button disappears

Hello. When I create a custom module and add the button for printing PDF everything works out of the box. As soon as I edit the views to add my fields the button disappears. Any ideas as why with a brand new custom module the button is there and as soon as I edit the module the button is gone.

What Suite version are you running. And PHP version.

Hello @symbiotico

I had something similar but took multiple steps to reproduce this:

  1. Create a custom module
  2. Switch via the routes to the legacy view (Suite 8) via code
  3. Add the print feature to a custom module via code
  4. Update something in the module builder and redeploy - which would override my print feature code

Which steps did you take?

I’m running Suite 8.6.1 and PHP 8.2

I create a custom module with basic template. I edit the files via code to add the custom button. I deploy the module and everything works fine. If I add a custom field and edit the view to add the fields when I re-deploy the button disappears.

So via the module builder + redeploy - not via the Studio.

Same here. I assume the deployment package will override the custom/modules/your_module/ folder with the ‘new’ (non existing) metadata folder / contents from the package (so remove your customizations).

It’s actually the same for:

  1. first module builder
  2. then studio changes
  3. then re-deployment from module builder.

Are you using github or similar, where you could potentially work with forks or similar?

Thanks for all the replies. I`m making all the edits for the metadata in the modulebuilder folder so when I deploy my custom metadata files are transferred to the new module, but as soon as I make an edit in the module builder it stops working, even if the custom metadata file is available.

I found a solution. If I create a new module and make all the edits I need before deploying everything works as expected. So the problem arises if I make an edit post first deployment.

How are you doing the edits? Is it possible that you logging in as a different user, and so you’re breaking the ownerships/permissions on the file, when you save?

Or maybe you’re using an editor on Windows that breaks line terminators?

I´ve been doing all my edits on the module builder and the php files in the terminal with nano. If I deploy for the first time it seems to work, but as soon as I do another edit it stops working, even if the code and files are still on the module folder. The button doesn`t show anymore.

Check with

ls -al

in the directory where the file is.

My guess is that you have one file owner when it works, and a different one when it doesn’t, after editing with nano. Typically, because you are logging in as root.