Commit 5bfb1a86 authored by moshe weitzman's avatar moshe weitzman

add some initial code so cck field modules can participate in devel_generate....

add some initial code so cck field modules can participate in devel_generate. see #187599. patch by moshe weitzman.
parent 01b5e356
......@@ -84,6 +84,11 @@ function devel_create_nodes($records, $users, $title_length = 8, $add_upload = F
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);
......@@ -402,4 +407,12 @@ function devel_generate_add_upload(&$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
......@@ -71,13 +71,12 @@ function devel_generate_users_form_submit($form_id, &$form_state) {
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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment