I have shown how to do this in the context of surface integrals at:
Which is similar to legacy dolfin:
or you could use any of the suggestions by @francesco-ballarin