I want to have a section on all content types that allows the user to upload a teaser image (imagefield), specify alternate teaser body and title fields, and a few checkboxes for promoting to various views. I could use nodeapi to do something like this, but I'd have to reinvent the wheel with all the data storage involved there (especially filefield/imagefield).
So let's say I go into a certain content type, start adding all the fields that I want via CCK, get them ordered just the way I want, group them in a fieldset, then export that content type. So, theoretically, I can have my module programmatically install just the fields (similar to this) and add them to all of the site's existing content types:
<?php
module_invoke('content', 'clear_type_cache');
$filename = drupal_get_path('module', 'mymodule') . '/fields.cck';
$fields = implode('', file($filename));
// Build form state
$form_state = array(
'values' => array(
'type_name' => array_keys(node_get_types('names')),
'macro' => $fields,
),
);
// Inject our form into the CCK Import form.
drupal_execute("content_copy_import_form", $form_state);
?>In my fields.cck file I'd just add the exported cck content type, deleting out the whole $content[type] array.
Has anyone done something like this before that can give me some pointers if this is the best method?
Thanks..

Comments
Revised...
For some reason I thought type_name form element was a multi-select, so the above won't work since type_name can't accept an array. I'll update it later after I do some testing.
Here is my code
http://drupal.org/node/293663#comment-1126980