devel_generate_add_terms($node);
}
+ // Populate any CCK fields in the content type
+ if (module_exists("content")) {
+ devel_generate_fields($node);
+ }
+
// Save the node:
node_save($node);
$_SESSION['upload_files'][$file->fid] = $file;
$node->files[$file->fid] = $file;
+}
+
+// Enrich the $node that is about to be saved with arbitrary information in each of its CCK fields.
+// Not yet implemented by CCK fields. See http://drupal.org/node/187599 for status.
+function devel_generate_fields(&$node) {
+ $return = _content_field_invoke('generate', $node);
+ $array_node = array_merge((array)$node, $return);
+ $node = (object)$array_node;
}
\ No newline at end of file
function devel_generate_content_form() {
if (module_exists('content')) {
$types = content_types();
- $warn = '';
foreach ($types as $type) {
+ $warn = '';
if (count($type['fields'])) {
$warn = t('. <strong>Warning</strong>. This type contains CCK fields which won\'t be populated. See !url', array('!url' => l(t('this CCK issue.'), 'http://drupal.org/node/187599')));
}
$options[$type['type']] = t($type['name']). $warn;
- unset($warn);
}
}
else {