How to display the workflow status of a node in it's content?
doc2@drupalfr.org - November 16, 2007 - 14:48
Dear Drupalers,
Could someone tell me how I could show the worflow status of a node within it's content? (And eventually following to the nodetype within the search results)
I guess there is a simple PHP "Print" command to put in my page.tpl.php or in my node-type.tpl.php files, but I don't know how.
Which function to call? May the token.module help me? Will the specific functions to call be different in workflow_ng (I may migrate)?
Many thanks!
Arsène

Any ideas?
Maybe my previous question was not clear enough... here my second try...
I would like that the status (from the workflow module) gets displayed in the node content?
Any ideas how I could patch things?
Many thanks in advance for your input.
Arsène
All right, I think I got a
All right, I think I got a piece of a hint with the workflow_field.module : http://drupal.org/project/workflow_fields
Now that I have a workflow_field dedicated to my node's state, I'd like to have it automatically filled with the current worflow state.
1 - As it is possible to define a default value to fields:
> http://arsene.richard.free.fr/ged/workflow_state/Workflow_field-PHP_defi...
2 -... and moreover to have some PHP code that would do it
... I thought that some clever devz would catch the occasion to give me a hand!
A kind of a good clue: Here is a PHP snipet of what should fit, somehow, into place 1-. It's taken from the workflow.module from line to line. But only the line 128 seems useful:
> http://arsene.richard.free.fr/ged/workflow_state/Workflow_current_state_...
Hope I've been clear enough! Or let me know.
I made "fausse route" with
I made "fausse route" with this workflow_field.module... the English language is sometimes tricky!!!
Currently, I try to achieve that feature with the views_argument_api.module but I have no result yet..:
- node id argument EQUALS $node (1)
- workflow:state field chosen to show up in a...
- block view
-> Did I miss something?
Eventually, I'd use something like view_field to put my result within the node content... whenever I'll get this result!
(1) I used $node according to http://drupal.org/node/160921#comment-254062 yet this comment has been criticized. I had a look at but I am not enough experimented to understand everything...
Any help welcome!
Well, in fact I managed it
Well, in fact I managed it fine with workflow_fields! Just had to persevere.
Here's a draft, and I thought I could be able to edit it later on... http://drupal.org/node/209868 Sorry for the poor quality. I wish I could delete it...
Instructions Feedback
Hello Doc2,
I tried to follow your instructions, but I am unable to do so. Specifically Point 5 (Section B) is the culprit. Could you elaborate on that a little bit?
Greatly appreciated
At the time, I wasn't able
At the time, I wasn't able to theme my templates. Now that I can, I suggest that you use theming which is probably much more ressource efficient than the module settings I suggested by then.
In fact you may just need to write this piece of code somewhere in your node-tpl.php file:
print get_status_name($node->_workflow);In my zen theme, I have this :
<?php if ($teaser): ?> <!-- START OF "NON TEASER" THEME --><?php else: ?> <!-- I don't want the author infos to show up in my teaser views. -->
<?php if ($submitted): ?>
<span class="unsub">
<?php if(user_access('administer nodes')) // I want the author infos to show up only to users who have "administer nodes" access.
print get_node_type_name($node->nid).', '.get_status_name($node->_workflow).', '.$submitted.' '.novocname_taxonomy_links($node, 37,null,'link'); ?> <!-- I want to respectively display in the "submitted div": the nodetype, the workflow state, the author infos and finally the terms of an admin vocab witnessing the completeness of the node, separated by commas. -->
</span>
<?php endif; ?>
<?php endif; ?> <!-- END OF "NON TEASER" THEME -->
There must be an "endif" lacking but I don't exactly know where as I haven't made the code myself.
Hope this will work for you. Good luck!
'get_status_name' function???
I started playing around with some solutions, but I cannot find the referenced function, get_status_name, any where. Can you point me towards the implementation?
I also searched for
I also searched for that "get_status_name" function and didn't find it anywhere...
Perhaps there is a custom function in the template.php of your zen theme?
Edit: Now I saw the date of this thread... hmpf
Edit2: I found this one in the issue queue of the workflow module: http://drupal.org/node/107138#comment-487291 - and I think, it will help ;)
seubert-design.de