Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

field_states

140 sites Security covered
View on drupal.org

Field States module is base on state machine module. Unlike the standard state machine module, Field States offers an extended feature set. With this module, you have the flexibility to define a list of states, and within your field settings, you can easily specify transitions. This process becomes even more user-friendly, as you can conveniently copy and paste configurations directly from your workflow YAML files.

Field States uses library mermaid.js for visualizing your state machine, making it easy to understand and manage your states and transitions. Moreover, in the field formatter, you have the added convenience of selecting transitions effortlessly, enhancing your overall workflow management experience.

There are state machine editor. you can draw and config transitions (support only bootstrap 5 theme), It will create a state machine directly and not via yml configuration.

How to work

- Add field States transitions
- Fill all state in field storage (it looks like list string)
- set transitions in field settings (Yaml format)

  • label: Transition Button Name
  • from: [Multi states] # The states from which this transition is allowed
  • to: state # The state to which the field should transition
  • role: The role name that can see the transition button
  • permission: Permission can see button
  • group: Group id
  • guard: Guard Plugin ID in Your Custom Module (method allowed) #
  • workflow: [Multi workflow id] in your custom module (Pre-transitions method action)# Custom workflow logic if needed
  • action: [Multi action id] in your custom module (Post-transitions method execute)# Custom action logic if needed
  • extra: True|False
  • In case of you don't want to show extra field

guard: create custom/your_module/src/Plugin/Guard/CustomGuardPlugin.php
workflow: create custom/your_module/src/Plugin/Workflow/CustomWorkflowPlugin.php
action: create custom/your_module/src/Plugin/Action/CustomWorkflowPlugin.php
you can see exemple in module.

Extra field: In case you want to submit with a certain field, you can choose this field option. For example, when you want users to leave comments when changing status

History field: support double field, triple field, json table field

The Field State module for Drupal manages state machine transitions with a seamless process. To display the button, the module first verifies the [role], if it defines in field setting, ensuring it matches the [permission] if it defines in field setting. After that it will run [guard] to check. When the state transition button is pressed, the module triggers the execution of the [workflow]->action(), you can cutomize your logic before entity save. 'Cos this methode uses reference variable &$transitions. The module then saves the updated state to entity. It proceeds [action]->execute().

This comprehensive sequence ensures smooth and flexible handling of state transitions in the Drupal environment.

Do you like this module? Show your appreciation by buying me ☕.

Activity

Total releases
3
First release
Jan 2025
Latest release
1 month ago
Release cadence
205 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
2.0.4 Stable Mar 8, 2026
2.0.3 Stable Jul 7, 2025
2.0.2 Stable Jan 22, 2025