Labels for additional states
| Project: | Publishing |
| Version: | 4.7.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
I'm using the publishing module with workflows ala Merlin's recipe at http://www.angrydonuts.com/publishing_articles_a_tutorial . Our client needed some additional states for the workflow as they wanted an editor to be able to review, send for rework, etc., but not to be able to actually publish anything. Instead, once the editor marks it approved, then the master admin sets it to publish either for the Board of directors or for the general public. So in addition to the included creation, draft, review, rework, we have states called approved, board, and public (same as published, but makes the distinction from board publication clearer).
The system works beautifully, but we need to be able to include the block of info at the top of the node for the non-public states Approved and Board, so that the admins can tell what state the item is in, just as the draft, review, and rework states are marked. I see in lines 270-315 a switch block that creates the labels. What I don't quite get is where the variables tested for in the various cases come from. I suppose in the long run, the ability to add those blocks for whatever state would be great, but for my purposes, some suggestions about which portions need to be modified to adding a couple more cases would be great.
Note, I'm not certain how to tell which version I'm using. I had downloaded both and once they're exploded I don't know how to tell which is which.

#1
The original code that I used for this did this in the theme, and you can replicate that for your custom workflow states as a workaround. I do think that allowing this system to support new states in the flow and basically maintain them as part of the whole group is a good idea, and I will try to build that into the module, though it will take some time.
For now, the absolute easiest thing to do to set up some code in your node.tpl.php (or if you're comfortable with theming, you can do it in _phptemplate_variabes() -- that's a little more advanced than I have time to walk you through right now, so I'm going to go the super super simple method):
First, you need to find the SID (state IDs) of the states that you want to create messages for. These will be in the workflow_states table.
Then, in node.tpl.php, right before the
<?php print $content ?><?php if ($node->_workflow == PUT_YOUR_SID_HERE): ?><?php theme_add_style(drupal_get_path('module', 'publishing') . '/publishing.css'); ?>
<div class="publishing-node-box">
This <?php print $node->type ?> submission is currently a <b>STATE</b>. In order to ...whatever... go to <?php print l('workflow', "node/$node->nid/workflow") ?> tab and do whatever it is you need to do to it.
</div>
<?php endif; ?>
You'll have a block like this for each new state you want a message for.
Caveat: I haven't tested this so there may be a typo or something, but I hope that gets you close.