Juergen Posted May 25, 2023 Share Posted May 25, 2023 Hello @ all On my FrontendForms module, users can add their own custom email templates inside the "email_templates" folder of the module. The problem is that after updating the module, these files are no longer present (only the ones shipped with the module exist). In other words the custom files get lost. During an update the"old" module directory will be renamed with a dot in the front position (.FrontendForms in this case) and the new version will be downloaded from the module directory. After the update, the module files exist twice: .FrontendForms and FrontendForms directory. The old directory contains the custom templates added by the user, the newly downloaded not. Goal: The custom files should be copied from the old folder to the new one. I have tried to use the upgrade function of the module to copy the files from the old folder to the new one, but this does not work properly, because it only happens if the user clicks the button "Continue to module settings" afterwards. Otherwise the files will not be copied to the new version. This is not working the way that I wanted. Is there someone that has created a module which also allows the user to add custom files to the module and has a working solution how to prevent those files to be gone after an update? BTW: I want to prevent storing the custom files outside the module folder (fe. in site/assets/files) if not absolutely necessary. Any help or idea will be appreciated. Thanks Link to comment Share on other sites More sharing options...
bernhard Posted May 25, 2023 Share Posted May 25, 2023 3 hours ago, Juergen said: BTW: I want to prevent storing the custom files outside the module folder (fe. in site/assets/files) if not absolutely necessary. Why? This is the way everybody else does it ? I'd recommend using a folder in /site/templates, eg /site/templates/FrontendForms - if you choose one in /site/assets the files will not be translatable. 2 Link to comment Share on other sites More sharing options...
Juergen Posted May 25, 2023 Author Share Posted May 25, 2023 2 minutes ago, bernhard said: I'd recommend using a folder in /site/templates, eg /site/templates/FrontendForms - if you choose one in /site/assets the files will not be translatable. Ok, thanks @bernhard!! 3 minutes ago, bernhard said: Why? This is the way everybody else does it ? I have not seen that before and my thought was to keep it all inside the FrontendForms folder and not separated all over the site?. So I will add an extra folder beside the templates folder for the custom email templates. 1 Link to comment Share on other sites More sharing options...
bernhard Posted May 25, 2023 Share Posted May 25, 2023 The separation here is on purpose. Everything in the module folder comes from the module folder. Everything outside comes from the user ? Same as with /wire folder and /site folder. 1 Link to comment Share on other sites More sharing options...
Juergen Posted May 25, 2023 Author Share Posted May 25, 2023 Ok, now it is much clearer to me - new thing learned!! ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now