This is an old wish of mine, and appears to be necessary for #2102409: [META] Support multiple workflow_fields per Node type (Entity bundle).
1. Some people would like to customize the Workflow Tab more to their needs.
2. If you have 2 workflow fields on 1 entity type/bundle, then the current workflow tab is useless. It is also not Programmable: "which of the workflow fields should you show? In which order? What if a user only has access to one of the workflows?"
Here is a recipe for this:
- disable 'Use the workflow history tab' in the settings of your Workflow Field (optional);
- create a new view mode 'workflow' on the entities with workflows;
- create a new view 'workflow history tab', with 2 parts: a 'page' with a rendered entity in view mode 'workflow', and an 'attachment' with a list of transitions;
- test all cases (entities with/without workflow, users with/without access)
- set the view mode to your needs;
Moving the 'workflow tab' into a view makes the following code obsolete:
- workflow_tab_page(), which shows the page;
- workflow_tab_access(), which defines a access routine;
- workflow_menu, which defines menu items;
Comment | File | Size | Author |
---|---|---|---|
#1 | workflow_views_history_tab_view_mode.patch | 906 bytes | johnv |
#1 | workflow_views.history_tab.view_.txt | 18.41 KB | johnv |
Comments
Comment #1
johnvPlease find attached:
- a patch to create a new view_mode;
- a view, which you can import;
See the recipe above to use this.
Comment #2
johnvComment #4
johnvA new view 'history per entity' is created. It is disabled by default.
You can use it to change the appearance of the workflow_tab.
To change the first half of the page (the workflow form), you can change the View mode of entities.
To change the second part of the page, change the 'Attachment' display of the View.
Comment #5
johnvComment #6
preddy CreditAttribution: preddy commentedmethod 'workflow_views_entity_info_alter ':
Need to handle 'field_info_field_map()' method for drupal version prior to 7.22.
$field_map_available = version_compare(VERSION, '7.22', '>=');
$field_maps = $field_map_available ? field_info_field_map() : field_info_fields();
Comment #8
johnvThanks.
I already have a function for that. Fixed with above commit.
Comment #9
johnvComment #11
johnv