Fresh Blurbs

CCK Import During Install

We've blogged about hardcore Drupal Form Manipulations using CCK Node Types and hooks. If it is part of your module (as it should) you need to install CCK type during module setup. In the .install file of that module you can import CCK definition with a code like:

function ourmodule_CCK_install() {

    $modulepath = drupal_get_path ('module', 'ourmodule');  
    $cck_definition_file = $modulepath."/custom.cck";

  $values['type_name'] = '<create>';
  $values['macro'] = file_get_contents($cck_definition_file);

  include_once( drupal_get_path('module', 'node') .'/content_types.inc');
  include_once( drupal_get_path('module', 'content') .'/content_admin.inc');

  drupal_execute("content_copy_import_form", $values); 
}

where custom.cck under your module folder is the file that you can export from CCK if you have cck_content_copy module installed.

comments powered by Disqus