Drupal is a registered trademark of Dries Buytaert

The Workflow Required by State module allows fields to be required only when the associated entity (or parent entity) is in a specific workflow state.

N.B. This module extends the contrib Workflow module, and not core's content-moderation workflows.

USE CASES

The primary use case for this module is:

  • To make complex multi-participant workflows less error-prone.

REQUIREMENTS

This module requires the Workflow module.

INSTALLATION

Install as you would normally install a contributed Drupal module.
See: https://www.drupal.org/node/895232 for further information.

CONFIGURATION

You'll need the following before being able to configure this module's settings.

  • Add one or more workflows and populate them with some workflow states.
  • Add a content type and add a workflow field to it.
  • Add a field that you want to make dependent on the workflow state.

To configure this module's settings:

  • Open the settings of field that you want to make dependent on the workflow state.
  • Ensure that the "Required" checkbox is not checked.
  • Check the "Override the required flag per workflow state" checkbox.
  • Select the desired workflow from the "Select the workflow on which this field should depend" list.
  • Check the desired states from the "Select the workflow states that will make this field required" checkboxes.

The configuration checkbox labeled "Set field as required immediately upon selecting workflow state using Javascript." allows you to alter the behaviour of this module for a given field:

  • If you prefer to have the "required" state of the configured field take effect only after the form is submitted and the entity is in the desired state, leave this checkbox unchecked.
  • If you want the configured field to be flagged as required dynamically as soon as the Workflow state field value has changed, check this box, and Workflow Required by State will add some Javascript to the page to achieve this.

SIMILAR MODULES

  • Conditional Fields module should be able to achieve a similar behaviour if your entity form is simple and you want the "required" state of the desired field to take effect immediately.

Activity

Total releases
2
First release
Feb 2025
Latest release
1 year ago
Release cadence
1 day
Stability
0% stable

Releases

Version Type Release date
1.0.0-beta4 Pre-release Feb 7, 2025
1.0.0-beta3 Pre-release Feb 6, 2025