workflow_help showing on pages
mrsocks - June 14, 2007 - 16:09
| Project: | Workflow |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Description
I am getting the help menu on nodes that are uncategorized.
This shows up with logged in or anonymous.
'You are currently viewing the possible transitions to and from workflow states. ....' shows up at the top of a node even if there is content in the node. There are also no tabs for the workflow states when not logged in or when the user
Only seems to be happening on the nodes that are uncategorized.

#1
I dont fully understand why the menu shows up on the uncategorized node pages, but I have figured out how to fix it from showing FOR MY INSTALL.
I had to change the workflow_help function to:
/**
* Implementation of hook_help().
*/
function workflow_help($section) {
$workflow_menu_section = explode('/', $section);
$workflow_vars = $workflow_menu_section[2].'/'.$workflow_menu_section[3];
switch ($workflow_vars) {
// case strstr($section, 'admin/build/workflow/edit'):
case 'workflow/edit':
return t('You are currently viewing the possible transitions to and from workflow states. The state is shown in the left column; the state to be moved to is to the right. For each transition, check the box next to the role(s) that may initiate the transition. For example, if only the hulking_editor role may move a node from Review state to the Published state, check the box next to hulking_editor. The author role is built in and refers to the user who authored the node.');
break;
// case 'admin/build/workflow/add':
case 'workflow/add':
return t('To get started, provide a name for your workflow. This name will be used as a label when the workflow status is shown during node editing.');
break;
// case strstr($section, 'admin/build/workflow/state'):
case 'workflow/state':
return t('Enter the name for a state in your workflow. For example, if you were doing a meal workflow it may include states like <em>shop</em>, <em>prepare food</em>, <em>eat</em>, and <em>clean up</em>.');
break;
// case strstr($section, 'admin/build/workflow/actions') && (sizeof($section) == 22):
case 'workflow/actions':
return t('Use this page to set actions to happen when transitions occur. To <a href="@link">configure actions</a>, use the actions module.', array('@link' => url('admin/actions')));
break;
}
}
First, per php, there should be a 'break;' after each case check otherwise it continues to process the rest of the cases.
Then: case strstr($section, 'admin/build/workflow/edit'):
would actually return: admin/build/workflow/edit...............and anything after the needle (the second para in the strstr function)
so, yes, it is matching the whole $section string like it should BUT i dont know enough about the drupal hook system to know why this is happening.
Anyway,
so i made the hook more dependant on specific vals by exploding and using the two specific vals for the array of the url.
This WONT work if you move the install to a new dir. like domain.com/drupal/
SO THIS IS A HACK that works for me.
#2
I ran into the same issue. Here's a smaller patch that also works: add the indicated two lines after the switch. The strstr case always matches when compared against an empty section, so the new case prevents it from being reached.
<?php/**
* Implementation of hook_help().
*/
function workflow_help($section) {
switch ($section) {
case '': // ashearer 2007-08-12
return ''; // ashearer 2007-08-12
case strstr($section, 'admin/build/workflow/edit'):
return ...
?>
#3
Patch version of the above. Tested with Drupal 5.2 and PHP 5.2.2 on Linux.
#4
I can't confirm the bug, nor can I see how it can be reproduced. If someone can provide a step by step on how to make it happen, I'll commit this.
#5
I have the same problem...for me it only shows up on 404 pages...adding the case '':break; solved the problem for me.