Move CustomField to field class code to a mixin

Rather than repeating the same bit of code, put it in a mixin for maximum DRY :)