| 1 |
<?php
|
| 2 |
/* $Id: import_flexinode.inc,v 1.5 2005/07/01 23:37:02 drumm Exp $ */
|
| 3 |
|
| 4 |
function content_node_import_types() {
|
| 5 |
$types = array();
|
| 6 |
foreach (_content_types() as $id => $type) {
|
| 7 |
$types[$id] = $type->label;
|
| 8 |
}
|
| 9 |
return $types;
|
| 10 |
}
|
| 11 |
|
| 12 |
function content_node_import_fields($type) {
|
| 13 |
$types = _content_types();
|
| 14 |
if (!isset($types[$type])) return;
|
| 15 |
|
| 16 |
$content_type = $types[$type];
|
| 17 |
$fields = array();
|
| 18 |
|
| 19 |
//add the title field
|
| 20 |
$fields['title'] = $content_type->title_label;
|
| 21 |
|
| 22 |
//add all cck widget fields
|
| 23 |
foreach ($content_type->fields as $field) {
|
| 24 |
$fields[$field['field_name']] = $field['widget']['label'];
|
| 25 |
}
|
| 26 |
return $fields;
|
| 27 |
}
|
| 28 |
|
| 29 |
function content_node_import_prepare(&$node, $preview = FALSE) {
|
| 30 |
$types = _content_types();
|
| 31 |
if (!isset($types[$node->type])) return;
|
| 32 |
$content_type = $types[$node->type];
|
| 33 |
//add all cck widget fields
|
| 34 |
foreach ($content_type->fields as $field) {
|
| 35 |
$thisval = $node->$field['field_name'];
|
| 36 |
$node->$field['field_name'] = array('value' => $thisval);
|
| 37 |
}
|
| 38 |
return;
|
| 39 |
}
|
| 40 |
?>
|