Thursday, March 01, 2012

Drupal 7 Notice: undefined index node workflow_tokens()

Was getting the following messages on my Drupal 7 site:
Notice: Trying to get property of non-object in workflow_tokens() (line 189 of /var/www/drupal/sites7/all/modules/contrib/workflow/workflow.module).

Notice: Undefined index: node in workflow_tokens() (line 188 of /var/www/drupal/sites7/all/modules/contrib/workflow/workflow.module).
First I tried updating the workflow status for all the content I'd created for the site (about 12 nodes of sample content) to publish. Still saw the error, then remembered that earlier, I was getting notices from the Page Title module:
Notice: Trying to get property of non-object in views_page_title_pattern_alter() (line 47 of /var/www/drupal/sites7/all/modules/contrib/page_title/modules/views.page_title.inc).
I redefined the default for the page title settings to use the content page title token rather than the node title. Then defined the titles (using the node title token) for the custom nodes I'd defined on my site. This seemed to resolve the workflow_tokens notices.
Lookinig at the code it seems like the node argument required for the workflow_tokens function was not properly defined by the time lines 188 and 189 were reached in the processing. Not sure why this was occurring or how the Page Title module was impacting the function so if anyone can shed some light on that it could be helpful down the line.

No comments: