Submodule workflow_views is not proted to D8 yet.
Perhaps no new submodule is needed, but moving the code to \modules\workflow\src\Plugin\views\ is sufficient.
A volunteer (who likes to dive into the Views API) is requested to finish this.
-
There are the following use cases to test:
- a view with a list of nodes, with a Workflow field;
- a view with a list of non-nodes, with a Workflow field;
- a view with a list of nodes, with properties of the latest Workflow State (e.g., previous state, comment);
- a view with a list of non-nodes, with properties of the latest Workflow State (e.g., previous state, comment);
- a view with a list of executed transitions;
- a view with a list of scheduled transitions.
A list of current functionality:
1. file workflow_views.views.inc contains:
relation to WorkflowTransition, done via #2926408: Add Views relationship from entity to Transition- relation to WorkflowCurrentTransition
Workflow node- references to the new workflow handlers
2. handlers:
views_handler_argument_workflow_state(done, works by default or via filter)workflow_views_handler_field_comment_link_edit- workflow_views_handler_field_node_link_workflow
workflow_views_handler_field_sid(already provided by WorkflowTransition::basefieldDefinitions())workflow_views_handler_field_state(already provided by WorkflowTransition::basefieldDefinitions())workflow_views_handler_field_usernameworkflow_views_handler_filter_sid(done #19)
3. views:
- workflow_views.history_tab.view provides a user-configurable version of the history tab in #2927649: Make workflow_entity_history tab configurable as Views display
- workflow_views.summary.view provides a Dashboard
4. a permission to support the new views:
- 'access workflow summary views'
5.
- a link to the workflow history tab (in workflow_views_views_data())
Comment | File | Size | Author |
---|---|---|---|
#16 | workflow-views-filter_2.patch | 3.34 KB | brooksbrown |
#15 | workflow-views-filter.patch | 2.94 KB | brooksbrown |
Comments
Comment #2
johnvTested with a Wizard in workflow\src\Plugin\views\wizard (for usage in /admin/structure/views/add ).
But adding below default data into the Workflow Entities would suffice.
Comment #4
johnvAbove commit now adds default Views support for:
- Scheduled transitions;
- Executed Transitions;
by:
- adding an annotation of each of the classes
- adding 2 empty ViewsData classes to workflow/src
Comment #5
johnvComment #6
johnvComment #7
johnvThe 'workflow_views_handler_field_comment_link_edit' is provided by core.
Comment #8
johnv'workflow_views_handler_field_username' is provided by core views by adding an Advanced> Relationship>User relation in the Views View.
Comment #9
johnvLeaving this as it is. A volunteer (who likes to dive into the Views API) is requested to finish this.
Comment #10
johnvComment #14
johnvComment #15
brooksbrown CreditAttribution: brooksbrown commentedNot sure if this is helpful or not, but I was able to get the workflow field views filter working (diff attached).
Comment #16
brooksbrown CreditAttribution: brooksbrown commentedAttaching an updated diff that includes the missing schema addition.
Comment #17
johnv@brooksdown, thanks for your patch. I am testing it on a table of Content Types, and it works fine.
On a table of Content Type Revisions, an error is thrown, as described in #2446681-18: Error "Column 'langcode' in field list is ambiguous" thrown due to TranslationLanguageRenderer not rendering a field from a relationship, This error has apparently nothing to do with your patch.
I applied the patch, with the schema addition in a separate file workflow.views.schema.yml
Can you confirm this is OK?
Comment #18
johnvComment #20
johnvComment #21
johnvComment #22
johnvThere is an error in #16 and #19. $wid may be empty. This is fixed in the following commit.
Comment #25
bradflewelling CreditAttribution: bradflewelling commentedHey there, I'm using workflow and have the states setup and assigned to content types, however the only field available in views gives me the state of "saved" instead of the name of the state it was assigned, any suggestions would be great , thanks.
My Labels were not set , figured it out.
Comment #26
johnv@bradflewelling, indeed. Please see the attached related issues (in the right column of this page) for some other issues that handle this problem of not showing the Stae label correctly.
Comment #27
johnv@bradflewelling, after reading your post again, it is not about 'not showing' of 'shows key, not value', but about something else.
Please open an new issue, an attach a screendump of your view.
Comment #28
johnvComment #29
johnvComment #30
johnvComment #31
gagarine CreditAttribution: gagarine as a volunteer commentedIs this a chance to get committed? What is missing?
Comment #32
johnvAll is committed a long time ago. Ticket should have been closed.
According to a brief look at the code, the following is added:
- Filter
- Argument (in the URL)
Since in D8, Workflow is a field, with reference to an entity, all other requirements should be managable with normal Views functionality, amongst others a relation from Content to Workflow State.
There is also a default View: 'Workflow Entity history'