Adding a CiviCRM-based Field to a CCK Data Type
To actually see CiviCRM data inside of Drupal, you need to add a CiviNode widget into one of your CCK data types. Here are some quick steps to get you started:
- Go to Admin / Content / Content Types, and either create a new data type, or select one you'd like to add a CiviCRM field to. See the CCK Handbook for more information.
- Choose "Add Field". If you've activated CiviNode and the CiviCRM CCK Widgets module, you'll see a couple of new widget types in the "Field Types" section: the CiviCRM Contact and CiviCRM Group widgets. The contact widget comes in two basic "flavors": a "Contact Selector", which is a simple pop-up, and the "Contact Autocompletor", which uses AJAX (i.e., JavaScript) to search for contacts. The Contact Selector is a good choice if you have a small group of contacts you want to assign to a field (say, for a "Group Leaders" or "Staff Assigned" field). Use the Autocompleter if you need to search for one contact out of a large group (say, one voter out of a hundred thousand in a voter information database). If you have ever used the Node Reference or User Reference widgets from CCK, you'll recognize how the Autocompleter works. Hit "Create Field" to continue creating your field.
- On the next page see, you configure the field. At the bottom of the page, there are a couple of new options to configure in the "Data settings" section: Default CiviCRM Group, and Default CiviCRM Profile. The default group setting lets you restrict the contacts that a field will display to only those contacts belonging to a CiviCRM group. You will almost always want to choose this option, especially if you use a Contact Selector. The default profile setting lets you control what contact fields from CiviCRM you want displayed. This allows you to control who sees what fields, and helps keep your private data private.
- Once you've configured your field, you will probably also want to set up the way the field will display in node pages. Go to the Display Fields section of the Manage Fields page, and choose a formatting option. You can choose to display only a single field of your contact (the default is the "display_name" field), or display the contact as a link into CiviCRM's contact viewing and editing page (you'll need to grant the web user the rights to do see this, of course), or as a Profile. You can set different settings for the Teaser display than for a full page display.
There are a lot more features to CiviNode, and the module is under active development. But hopefully, this will get you started.
