Since workflow version 7.x-2.x, the workflow field is a 'true' field. Some modules exist to alter the appearance of a field, depending on the value of another field.

In D8 and further, this can be done using Conditional Fields module, since the Workflow State value is just another ordinary field, with a more complex widget.

This issue tries to explore the different approaches, and tries to create a battle plan.
(Note: This issue is NOT about 'alter the access of an entity, depending on the value of a (workflow) field'. That is already handled by the submodule workflow_access.)

In the past, some add-on modules have been created. The maintainers of these modules (and others) are invited to think about the future of 'Workflow Conditional Field Access':

  1. Workflow Content Permissions sets field-level permissions for Content fields of node participating in a Workflow (44 sites) "On permissions page: role R can view/edit field for content type X in state Z"
  2. Workflow Fields Adds per-field settings to each workflow state. (500 sites, up to 7.x-2.x) In workflow Settings page
  3. Workflow Private Comments Allows to hide workflow comments based on the state of a node and role of ther user. It's basically so admins can comment about that's going on in a workflow state change without lesser roles being able to see what they said. (23 sites, up to 6.x)
  4. Workflow required allows required fields to be left empty when the node is in selected workflow states. (0 sites, up to 7.x)
  5. Workflow Required Fields sets requirements on fields depending on the workflow state of the node (65 sites, up to 7-1.2) In workflow Settings page
  6. Workflow Field groups allows you to control which field groups may be accessed depending on the current workflow state. Control can be specified by role. Currently this only applies to form displays and not view displays. Different settings can also be set per form display mode. (1 site, D8 only)

  7. There are also generic modules. Perhaps one of these generic modules are sufficient, since D8-Workflow is now a 'proper' field:

  8. Field Permissions sett field-level permissions to create, update or view fields. (66k sites) "On field settings page: role R can create/edit/view own/any field Y on content type X"
  9. Conditional Fields sets the visibility of a field, depending on the value of another field (50k sites, poorly maintained)
  10. Field Conditional States is a light-weight competitor for Conditional Fields. (2k sites)

Comments

johnv created an issue. See original summary.

johnv’s picture

Issue summary: View changes
johnv’s picture

johnv’s picture

Issue summary: View changes
johnv’s picture

Issue summary: View changes
rafuel92’s picture

Hello, i am working at a drupal 8 version of the workflow fields module, this version based on the state of the workflow field changes permissions of the selected fields and allow you to choose which field is visible and which field is editable for each state.

johnv’s picture

Hi Rafuel92, that is good news! I would be happy to test it.
Just to stretch your goal: perhaps we can use your module to also #318325: [Meta] Display/hide/require the Widget subfields based on State/Role

johnv’s picture

Publishing Future’s picture

Any progress on this? This functionality is really needed (esp. making fields required/not required based on workflow state, e.g. for a draft state where the user should be able to save the node even if required fields are left empty).

johnv’s picture

At This moment, for D8, I would recommend using Conditional Fields module.

Publishing Future’s picture

Unfortunately Conditional Fields does not allow to make a field dependent from a workflow state that is stored in a workflow field. That's why an alternative is needed. Furthermore, with conditional fields I would have to add the condition to any of the (about 100) fields that is affected. Having an option to prevent validation for_ all_ required fields for a given workflow state at one time would be a great advantage over that.

johnv’s picture

That is strange.. Workflow should behalve like a normal field, like any other. The State is the value of the field. The fact that there is a transition behind it, and a complex widget, does not change that.
There is a other issue requesting for Webform support. It makes me think, perhaps some API is missing...

fishfree’s picture

+1 pls. Especially implement the feature of https://www.drupal.org/project/workflow_fields

johnv’s picture

Category: Plan » Feature request
johnv’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)