Question

I have a bunch of custom fields on a custom content type. I'm trying to make my module create these fields and remove them on install and uninstall respectively.

There was a previous question and answer on this: https://drupal.stackexchange.com/a/629/2384 However, it is not adequate. The code was not completely presented. The author used node_type_delete() without deleting the content first, and that allegedly leads to trouble later down the line. So I checked the node_example.module as per recommendations on Drupal.org, node_example.install etc. These files provide insight into the structure of the module, but do not discuss all the varieties of fields (like file, taxonomy, etc.,) and how they are to be structured in the .install array.

I have tried to export my content type using Features, and it does produce an array. But the syntax is radically different from what was presented in the example, and I was lost in the arrays and sub-sub arrays.

Is there a simple guide somewhere, that can help me convert my content type into an array specification I can smoothly fit into my hook_install declarations?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top