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.

CommentFileSizeAuthor
#3 solution-1_rc.zip1.41 KBHardik C

Comments

dave reid’s picture

Status: Active » Closed (works as designed)

You 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.

pwieck’s picture

Thank you. I'm a little overwhelmed with moving to Drupal 7

Just added $node->language = LANGUAGE_NONE; and now all is fine.

Hardik C’s picture

StatusFileSize
new1.41 KB

Hi All,

The attached solution patches with your application. It will be useful to get desired results.

Regards,
Hardik