I love it when one blog post leads to another. This time, it was a post about having a dropdown powered by a function rather than the normal array of static option, where a comment to the posted asked where they could put the function so it would be picked up automatically and done in an upgrade-safe way. Turns out there is such a place, and as pointed out it’s not well documented.
You have two places to pick from. You can either:
- Put your function in the custom/include/custom_utils.php file
- Add a new PHP file with your function in the custom/Extension/application/Ext/Utils/ directory and do a Quick Rebuild and Repair to have it become available.
The latter option is the much more preferable approach if you are developing module loadable modules, so you can cleanly add and remove custom global functions easily. If you are just doing a customization for your own instance, than the first approach will work fine.