I created my own node type in Drupal 7 using the method hook_node_infoin the installation file:
function foo_node_info ( ) {
return array(
'foo' => array(
'name' => t('Foo entry'),
'base' => 'node_content',
'description' => t('For use to store foo entries.'),
));
}
and I'm trying to save this type in a module file using the following code:
node_save(node_submit((object)array(
'type' => 'foo',
'is_new' => true,
'uid' => 1,
'title' => 'Title, blah blah blah',
'url' => 'url here, just pretend',
'body' => '<p>test</p>',
)));
My problem is that url and body fields are not saved. Any idea what I'm doing wrong?
source
share