Was at Drupal 7.8 now at 7.9 with same results. I'm am getting the following notice in logs on all pages with embedded custom cck forms:
Notice: Undefined property: stdClass::$language in pathauto_form_node_form_alter() (line 427 of /home/my_server/mysite.com/sites/all/modules/pathauto/pathauto.module).
Embedding form in block using:
<?php
$node = new stdClass();
$node->type = 'sidebar_form';
module_load_include('inc', 'node', 'node.pages');
$myform = drupal_get_form('sidebar_form_node_form', $node);
$output = render($myform);
print $output;
?>
Hiding unwanted form items using:
function mytheme_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'sidebar_form_node_form') {
hide($form['menu']);
hide($form['author']);
hide($form['options']);
hide($form['revision_information']);
hide($form['metatags']);
hide($form['xmlsitemap']);
hide($form['path']);
hide($form['comment_settings']);
hide($form['title']);
}
}
Thank you for your time.
Comments
Comment #1
dave reidYou have to define a few more properties on the node object before you can pass it into a node add form. See http://api.drupal.org/api/drupal/modules--node--node.pages.inc/function/... - you have to define $node->uid, $node->name, $node->type, and $node->language.
Comment #2
pwieck commentedThank you. I'm a little overwhelmed with moving to Drupal 7
Just added $node->language = LANGUAGE_NONE; and now all is fine.
Comment #3
Hardik C commentedHi All,
The attached solution patches with your application. It will be useful to get desired results.
Regards,
Hardik