I want to use CCK from other module (my_module). Is there a CCK API? When the module is installed I want to create automatically, in my_module.install, the following:

  • a new content type
  • new fields for this new content type
  • other CCK specific configurations for these

Where can I find references about CCK API (is exists).

Thanks!

Comments

yched’s picture

Status: Active » Closed (duplicate)

see http://drupal.org/node/118863 - there are some open questions about that, still unsolved...

claudiu.cristea’s picture

Not sure that this is what I'm looking for... I'm searching for a API. I want to create a content type & fields through CCK but directly from PHP (module.install).

yched’s picture

yes, that's exactly what the referenced thread is about

claudiu.cristea’s picture

Maybe... But it make no sense to me. I need something that can be referenced like:

add_type(array(
  'type' => 'my_type',
  'name' => 'My Type',
  'description' => 'This is my content type'
.... other data
));

add_fields('my_type', array(
  array (
    'widget_type' => 'image',
    'label' => 'Logo',
    'weight' => '0',
    'max_resolution' => '120x60',
.... other data
  )
));
claudiu.cristea’s picture

Supposing that I'm applying that patch, what function do I need to call? How?

yched’s picture

Please follow up using the referenced thread.
As you can read over there : there is no such functionality at the moment. There are still unresolved issues or questions. So the short answer is : 'well, you can't'.

If you do think additional time and efforts should be put in this, feel free to join the discussion / provide feedback / contribute some code - *using the right thread*. This is open source. Issues get fixed and features get added only if there are people with the will, the ability _and_ the time.

csbened’s picture

Here you find the answer, using CCK import
http://groups.drupal.org/node/5272#comment-54181