I created an example for this a little while back now but it should still function:
I’m specifically doing this via the extensions system in v4: