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:

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_username
  • workflow_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())

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnv created an issue. See original summary.

johnv’s picture

Tested 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.

 *   handlers = {
 *     "views_data" = "Drupal\workflow\WorkflowTransitionViewsData",
 *   },

  • johnv committed 72db2ff on 8.x-1.x
    Issue #2595877: [D8-port task] add default Views support
    
johnv’s picture

Above 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

johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes

The 'workflow_views_handler_field_comment_link_edit' is provided by core.

johnv’s picture

Issue summary: View changes

'workflow_views_handler_field_username' is provided by core views by adding an Advanced> Relationship>User relation in the Views View.

johnv’s picture

Issue summary: View changes
Issue tags: +views integration, +Novice, +php-novice

Leaving this as it is. A volunteer (who likes to dive into the Views API) is requested to finish this.

johnv’s picture

Issue summary: View changes

  • johnv committed bf1180d on 8.x-1.x
    Issue #2595877: Add language_code to entity_keys. Necessary for Views.
    

  • johnv committed c2ab0bb on 8.x-1.x
    Issue #2595877: Add language_code and list_builder to...

  • johnv committed 8e64a67 on 8.x-1.x
    Issue #2595877: Added src/Plugin/views/filter/WorkflowState
    
johnv’s picture

Issue summary: View changes
brooksbrown’s picture

FileSize
2.94 KB

Not sure if this is helpful or not, but I was able to get the workflow field views filter working (diff attached).

brooksbrown’s picture

Attaching an updated diff that includes the missing schema addition.

johnv’s picture

Issue summary: View changes
Status: Active » Needs work

@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?

johnv’s picture

Issue summary: View changes

  • johnv committed 53e839c on 8.x-1.x authored by brooksbrown
    Issue #2595877 by brooksbrown: Add Views WorkflowState filter
    
johnv’s picture

Issue summary: View changes
johnv’s picture

Status: Needs work » Active
johnv’s picture

There is an error in #16 and #19. $wid may be empty. This is fixed in the following commit.

  • johnv committed 5752746 on 8.x-1.x
    Issue #2595877 by brooksbrown: Add Views WorkflowState filter
    

  • johnv committed 178c3a4 on 8.x-1.x
    Issue #2595877: add views support
    
bradflewelling’s picture

Hey 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.

johnv’s picture

@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.

johnv’s picture

@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.

johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes
gagarine’s picture

Issue tags: -

Is this a chance to get committed? What is missing?

johnv’s picture

Version: 8.x-1.x-dev » 8.x-1.0
Status: Active » Fixed

All 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'

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.