[development] Importing CCK content types during module installation

Randy Fay randy at randyfay.com
Tue Sep 7 11:29:49 UTC 2010


Hi Everett -

The current canonical way of adding content types now is with the Features
module. (The old ways you mention do work, but Features is *so* much better)

So you can just make your new module dependent on a feature that defines the
content type you need.

-Randy

On Tue, Sep 7, 2010 at 1:10 PM, E.J. Zufelt <lists at zufelt.ca> wrote:

> 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
>
> http://www.openbandlabs.com/blog/2009/06/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
> http://drupal.org/node/297972
>
> * I didn't read the entire issue, but this seems fixed in 6.x
>
> pausing a batch process for form submission
> http://drupal.org/node/283594
>
> * 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
> http://zufelt.ca
>
> Follow me on Twitter
> http://twitter.com/ezufelt
>
> View my LinkedIn Profile
> http://www.linkedin.com/in/ezufelt
>
>
>
>


-- 
Randy Fay
Drupal Module and Site Development
randy at randyfay.com
+1  970.462.7450
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100907/b612279e/attachment.html 


More information about the development mailing list