There are 2 different ways to create a new content type programmatically.
- First one, which I also use, is to create it in your custom module's
node_type_save()and attaching the fields also in
- The second one, which in Node Example module is used, is to create it in your custom module's
hook_node_info()and creating and attaching the field instances in
I am preferring the first method, since my feelings say that is better to maintain (i.e. adding/updating new fields via
hook_update_N()) and it suits better in
.install file. But, I keep myself asking why it is done other way in Node Example module.
Does anyone know the CONs and PROs of using both methods to create a new content type in code?