This must be done in a custom component.
Here is a fully fleshed out module with all of the code working you can download and add to your account: