I'm tempted to say that this could go in the api.ui.js file, as it doesn't really fit alongside the other admin functions.