我在Drupal 7中使用安装文件中的hook_node_info
方法创建了自定义节点类型:
// declare the new node type
function foo_node_info ( ) {
return array(
'foo' => array(
'name' => t('Foo entry'),
'base' => 'node_content',
'description' => t('For use to store foo entries.'),
));
} // END function foo_node_info
我正在尝试使用以下代码将此类型保存在模块文件中:
// INSERT the stuff
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>',
)));
我的问题是,URL和正文字段没有保存。你有什么想法我在做错了什么吗?