I have created a panels page that overrides the node add/edit form. When I go to the 'node/add/node_type' page to add a node, I get this error:
Notice: Undefined property: stdClass::$nid in workflow_tokens() (line 195 of sites/all/modules/workflow/workflow.module).
The code on line 195 is:
$last_history = workflow_get_workflow_node_history_by_nid($node->nid, 1);
As this is an empty node, the nid is not available yet. So I fixed it for now by changing line 195 to:
$last_history = isset($node->nid) ? workflow_get_workflow_node_history_by_nid($node->nid, 1) : new stdClass();
By the way, when I disable the panels page and the standard form to create a new node appears again, the error message is gone. So, it seems to me that Panels runs hook_tokens even when a node still needs to be created, while hook_tokens is not run when the standard add content form is displayed. I leave it up to the experts to decide if Panels needs to be fixed for that.
Comments
Comment #1
nancydruPlease try the latest -dev code.
Comment #2
nancydru#1511694: Better integration of workflow_node with panels