Theme colour switcher

Allow users to update an entity's Workflow status from a Drupal view

Background: I work on a site with different groups of users, to manage which we use not only core Drupal roles and permissions, but the Group module. Recently the site owner requested to add a Workflow to a content type. Clients need to be able to see the workflow state and change it, but not be able to see or edit the original node, or even the workflow tab on the node.

We manage client access to this content using Views, so the logical thing was to add a functionality for the client to change the workflow state directly from a view. I wasted way too much time going down rabbit trails of non-functioning solutions, when it turned out the answer is very simple and doesn't require anything more than the Workflow module itself.

The Workflow module has a "Workflow form" field formatter, which you can use to display the workflow form directly in the view.

Simply:

  1. Add the Workflow field from your content to the View
  2. In the field configuration, under "Formatter", choose "Workflow form"
  3. Set any other config you may need on the field and the view
  4. Save the view.

Et voila, the workflow form shows up allowing any user who has permission to participate in that workflow to change the workflow state for individual entities. If they don't have permission, or don't have permission to change from one particular state to another, they'll just see the current Workflow state as a label, rather than the form.

Tags:

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.