Posted by drupalnesia on September 27, 2010 at 5:52pm
I need to create a CCK field in my module. What is the best/right way?
From this link http://benbuckman.net/tech/10/01/drupal-automating-cck-field-creation-up... I got:
$form_state['values']['_add_new_field']['label'] = 'Name of New Field';
$form_state['values']['_add_new_field']['field_name'] = $new_field_name;
$form_state['values']['_add_new_field']['type'] = 'computed';
$form_state['values']['_add_new_field']['widget_type'] = 'computed';
$form_state['values']['_add_new_field']['parent'] = 'group_some_group'; // put under fieldgroup (optional)
// generate & submit the form
drupal_execute('content_field_overview_form', $form_state, $content_type);Is above code the best/right way?
Comments
Are you trying to create a
Are you trying to create a new field, or a new field instance? Your title says the former, but it looks like that page is talking about the latter.
The Boise Drupal Guy!