I'm creating one of my first Drupal modules which should create a node (type= page) when you activate the module, and then add some javascript to site.
But when I activate the module, it creates three nodes with the desired node-title, and drupal produces an error:
Notice: Undefined index: module i FieldInfo->prepareInstanceWidget() (linje 591 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo->prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo->prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
I am creating the node in the .module file like this:
$node = new stdClass();
$node->type = "page";
$node->title = "Page title";
$node->language = LANGUAGE_NONE;
$node->path = array('alias' => 'some-path');
node_object_prepare($node);
$node->uid = 1;
// Let's add standard body field
$node->body[$node->language][0]['value'] = 'This is a body text';
$node->body[$node->language][0]['summary'] = '';
$node->body[$node->language][0]['format'] = 'full_html';
$node = node_submit($node);
node_save($node);
The above code is based on this article
If i were to use the above path for the node, i would get three pages created with the following paths (i have pathauto installed):
/some-path
/some-path
/page-title.html
All of the pages have the "Page title" title set, and if i edit them they all have the 'This is a body text' body content.
Any help would be appreciated.