Hello,
I created a module to provide a content type and several fields (text) for that content type.
The content type's purpose is to hold values that is parsed from a feed.
After creating the content type en fields the node is working good when I use the Fields UI to create a new node. I can enter en edit all data and all is desplayed properly.
However, when I create the node trough coding, the parsed data does not appear in the node object.
Strange thing is that the $node-> title and $node-> body, which are both also parsed from the feed, works good. Only the other field fail.
Here's the code:
<?php
function my_function_fill_nodes($id, $item_to_save, $web_page) {
// code removed - XPAT retrieving node details
$node = new stdClass();
$node-> type = 'ysm';
$node-> internal_id = $id; // TODO
$node-> title = $object_title;
$node->language = 'en';
node_object_prepare($node);
foreach (XXXXXXXXXXXXXXX) { // parsing a DOM object
switch(XXXXXXXXXXXXXX) {
case 'A' :
$node-> price[$node-> language][0]['value'] = $retrieved_value;
break;
case 'B' :
$node-> model[$node->language][0]['value'] = $retrieved_value;
break;
// this goes on for 10 items
default:
echo($retrieved_value . '| not matched
');
}
}
// seperate code parsing the body text ($body_text)