Generate hooks code for create and remove fields