Closed (fixed)
Project:
Workflow
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 May 2009 at 12:43 UTC
Updated:
7 Mar 2014 at 14:22 UTC
Jump to comment: Most recent
Comments
Comment #1
stodge commentedI could try to create a patch if someone could give a hint as to what changes are needed.
Comment #2
dawansv commentedHere is a solution that does not require changing the workflow module.
You can call the function that creates the workflow tab content from either your node template or a block. The trick is to include worlflow.pages.inc first.
So here is some code I have in my node.tpl.php (well in my case it's actually for a content type called resource, so its really in node-resource.tpl.php to be exact).
For the last line I used a bit of a hack to trim everything except the history table which is the only thing I want there--it's the only table and the last thing in the html output (as of now at least, so I have to keep an eye when updating the module). But you can display the workflow form as well by just doing print workflow_tab_page($node). Note that this does not remove the Workflow tab of course, which in my case I still want.
If doing this is in a block, you would have to do a node_load first...
As for the include, make sure it is the right path, but this should be if you follow drupal standard recommendation.
Comment #3
dman commentedDo you not already see it in the normal node form?

I do
... perhaps it's just permissions, or perhaps you didn't see it because it's collapsed.
I can't imagine that
strstr(workflow_tab_page($node),'<table');is a very safe way of changing your form!Comment #4
dawansv commentedYour snapshot above is in edit mode right? Indeed I see the workflow info in edit mode. The issue here is to display the workflow info when viewing the node (view tab) not editing it, in my case the workflow history which is essential for "super users" to see right away (not just under the workflow tab)
And yes I would agree the strstr business is definitely ugly. In my case because this is only displayed for a handful of super-users so I am not too worried because even if it breaks regular users do not see that.
Comment #5
Anonymous (not verified) commentedHi,
I also think there should be an option to display the "workflow history table" in non-edit mode. The hack above works and inspired me for another bad hack ;) But I believe it's a little nicer, since it's not messing around with strstr() - basically, it's just duplicating workflow_tab_page(). But I would really appreciate a solution of some professional niveau... Thanks!
Comment #6
geerlingguy commentedI used your code above (with just the
print workflow_tab_page($node);) to stick the workflow form in my node, and it seems to be working great - thanks!Comment #7
jhendricks47 commentedWhere did you put this code to get the effect? Many Thanks, Jeff
Comment #8
stefan81 commentedalso looking forward to guide how to print the status of the node (view mode), to use it for theming. Thanks :)
Comment #9
geerlingguy commentedJust after the $content variable was printed...
Comment #10
Grayside commentedTo display the current workflow state on my node, I did this in hook_nodeapi:
(Where I happen to know "1" is the workflow id.)
Comment #11
techypaul commentedHi,
Might be hijacking this a little - I am using views to basically show all the previous history of the workflow on the node itself which all users get to see and this works great, but would be really like to have the edit/add workflow widget above that so it looks like its part of the node, of course, only those with permissions will see it.
I am not 100% comfortable with messing around with all this php - is this the best way to achieve what I want to do?
Thanks,
Paul.
Comment #12
stefan81 commented@greyside
Thanks for your help!
Unfortunately I am a greenhorn... can you help my out with a step by step guide where to place this?
doe this go somewhere in template.php?
Comment #13
pendashteh commentedComment #14
Grayside commented@yanku #12:
That code calls for writing a custom module. Most complex Drupal sites have a custom module for one-off customizations, and that usually includes an implementation of hook_nodeapi().
My code above would go in a custom_module.module file, and be wrapped in:
Comment #15
nicostabile commentedhi to all! i put the code above in number #13 (to view the tab workflow into the node page), in my node.tpl.php and when i click submit ( to change the state ) the content is printed again so figures twice content of my node. If i submit again,adds to the content and i have three content printed. it´s like to $content add $content again. The content of workflow tab page it´s perfect.
My code is :
Anyone knows why?, or how i can fix it?,
Thanks in advance,
Nicolas.
EDIT: i solve this problem changing in my tlp.php:
removing print $content ;
adding each field like this:
print $field_namefield1_rendered;
print $field_namefield2_rendered;
print $field_namefield3_rendered;
i don´t know why it happens, what´s the difference?, ( i print all the fields that has $content.).
Comment #16
Encarte commentedsubscribing
Comment #17
Bastlynn commentedUnder your workflow edit page you should see the option to display the form to change workflow in the node or with the comment.
Otherwise, if you're looking just to display the history, then hook nodeapi in a custom module or template work in node.tpl.php as described above is the best way to go about adding anything more to the node display.
Comment #18
clockwood commentedI'm experiencing the same issue as #15. If I add the state change form to the node template using the same code as #15 (or printing workflow_extensions_change_state_form($node) from the Workflow Extensions module), the node's body field gets loaded with all my CCK field data.
Each time I change the state, it adds that same data again. So if I change the state 3 times, the cck data will show up 3 times in $node->content['body']['#value']. Checking the node_revisions table shows the data is being stored in the body column.
I disabled all non-core modules and used Garland theme to test and still had the same issue.
Comment #19
woibekwe commentedHello All,
The code solutions above are not working form me. I don't know if it is because im using 7.1 for Developers or because I am putting the code in the wrong place, but the workflow data does not show up on the view tab. Am I suppose to put the current solutions in node.tpl.php? If so where in that file am I suppose to put it? When I was debugging the view page I noticed that the node.tpl.php does not even get called when I click on the view tab link. If node.tpl.php is not where I put the the source solution there where would I put it?
Thank you fro all your help?
-Will
SOLUTION: I fixed it! I was editing the node.tpl.php in the node module not the template.
Comment #20
louis delacretaz commentedthe code at #10 can be simplified by calling workflow_get_state_name instead as in
Comment #21
davidwhthomas commentedNot sure why this is closed as designed, quite useful to show the current workflow state on the node view page.
Ideally would be done with
hook_field_extra_fields, but I adjusted the snippet in #20 for D7Cheers,
DT
Comment #22
anjjriit commentedThis is my compilation from all of you :
combined workflow page and form in node page
Comment #23
nancydruI don't understand "useful to show the current workflow state on the node view page." The module does that already - no mods needed.
Comment #24
maximpodorov commented@NancyDru
But it does it on 'full' view mode only! This is the problem.
Comment #25
andypostthis needs displayed via extra fields but should care about view mode settings
Comment #26
nancydruYou are correct. Committed.
Comment #28
mchaplin commentedThe workflow form won't show on the node if it is unpublished.
https://drupal.org/node/2164081