hi,

i had a content-type A that has a node-reference field B. when i add a node of type B manually everything is OK.
but nodes of type B that are created from node type of A add form have their comments disabled.

Comments

pendashteh’s picture

Component: Miscellaneous » Code

i looked into the code.
it seems the node_widget handles the form in a way that comment_form_alter() is not called. neither no hook_form_alter() or hook_form_submit() on the referenced node creation form is not called.
and it's kind of terrible! and will show up a lot of bugs and incompatibilities with other modules and custom themes soon or late and makes and it is not good at all for a module with such a functionality and structure.

Hek’s picture

Need to replace

// Add basic node information.
  foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language', 'changed') as $key) {
    $form[$key] = array('#type' => 'hidden', '#value' => isset($node->$key) ? $node->$key : NULL,);
  }

by

// Add basic node information.
  foreach (array('nid', 'vid', 'uid', 'created', 'type', 'language', 'changed', 'comment') as $key) {
    $form[$key] = array('#type' => 'hidden', '#value' => isset($node->$key) ? $node->$key : NULL,);
  }

in node_widget.form.inc (line 119)