[development] Importing CCK content types during module installation

E.J. Zufelt lists at zufelt.ca
Tue Sep 7 11:10:40 UTC 2010

Good morning,

I am looking for a method of importing CCK content types during module installation.  From what I have read this seems difficult, or perhaps impossible?  Any nudge in the right direction would be greatly appreciated.

Programmatic CCK content type creation

* This seems to indicate that this is not possible because of Batch API. It provides thorough code for importing CCK content types, but mentions that it cannot be used in hook_install()

drupal_execute is incompatible with batch API

* I didn't read the entire issue, but this seems fixed in 6.x

pausing a batch process for form submission

* I tried the recommendation here, but it didn't seem to work.  The recommendation is to save a copy byVal of $batch_get(), to set &$batch_get() = NULL, to perform the form execution, then to replace &batch_get() with the saved copy.

When I try the import described in the first article within myModule_install() I get no errors, but my content type does not exist when I check the list of content types.  If I use the suggestion about fooling Batch API into thinking there is no batch running in combination with the example in the first article I get the same result.  The module is enabled but the content type doesn't exist.

This makes me think that I will have to programmatically create, rather than import, the CCK content type, which I am not opposed to.  Any references to tutorials or book chapters that do a good job at explaining this would be appreciated.

Thanks in advance,
Everett Zufelt

Follow me on Twitter

View my LinkedIn Profile

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100907/53bcdba3/attachment.html 

More information about the development mailing list