how to add cck field to a content type Programatically in drupal 7? Possible Duplicate:
  Programmatically create Fields in Drupal 7  




I want to to add a cck field to a content type Programatically in drupal 7.

Any one who have some idea about this?
The main functions of the Content Creation Kit (CCK) have migrated into core in Drupal 7. Now every object used by Drupal (users, nodes, even taxonomy terms) are "fieldable entities." What does this mean? Simply that you can add fields to most objects in Drupal out of the box, no CCK required!

If you're building a module that alters pre-existing node types, you'll need to check out the Entity API. I'm not too familiar with it myself, however, it doesn't seem that hard to programmatically add fields. As Bojan Zivanovic mentioned, there are many other answers dealing with this on Drupal StackExchange, here are a few for you to peruse:

- Programmatically Creating Fields in Drupal 7

- Assign Fields Programmatically to Custom Node in Custom Module

If you're just adding fields to nodes for site building purposes, I'd just use the UI.

To do so...


Go to the "Structure" menu.
Select "Content Types."
Click on "Manage fields" next to the content type you want to add fields to.


You should then be presented with an interface to add new fields to your content type, much like you did with CCK in Drupal 6.