Don't know the actual functions necessary, but maybe take a look at the newest oUF and see how Haste handles things.
oUF
Haste has separated the layout from the unitframe, so if you want to see the results, you will need both oUF and one of the layout files:
oUF_ExampleLayout1
oUF_Industrial