(Tips) Programatically creating a CCK field in Drupal 6
Tips : Programatically creating a CCK field in Drupal 6
The first step is to create the field using CCK's UI. Once you've got the
field setup the way you'd like it use PHP's var_export()
to dump the contents of the node's field as an array:
var_export(content_fields('field_translator_note',
'feature'));
That'll give you some massive array definition that you can copy and paste
into your code.
<?php
$field = array (
'field_name' =>
'field_translator_note',
'type_name' =>
'feature',
'display_settings' =>
array (
4 =>
array (
'format'
=> 'hidden',
),
2 =>
array (
'format'
=> 'hidden',
),
3 =>
array (
'format'
=> 'hidden',
),
'label' =>
array (
'format'
=> 'hidden',
),
'teaser' =>
array (
'format'
=> 'hidden',
),
'full' =>
array (
'format'
=> 'hidden',
),..............................Continue..
Courtesy : Drewish.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)