If the function is used across pages and content types then it should be moved to a shared file - probably `.module`