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

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

Please try the latest -dev code.

nancydru’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)