Plugin system is still in development and so modifying the code for such little tweaks is still the best way to do and you found exactly the right function therefore I think ;)

Yes osTicket is git controlled, so when you like to do a pull request, feel free to do so. When the developers agree with your code they may merge it and everyone can benefit - but no guarantee that they will like it / merge it - but suggesting is better as hiding such nice little enhancements in my opinion.

Writing from the phone (currently on the move/bus) so I keep it short this time... Just create a pull request over at the official github repo in the develop branch: https://github.com/osTicket/osTicket-1.8