Provide a Workflow FieldType that references a workflow entity and tracks the current state of an entity

Created on 13 December 2016, about 8 years ago
Updated 30 January 2023, almost 2 years ago

Problem/Motivation

Followup to #2779647: Add a workflow component, ui module, and implement it in content moderation .

In #2779647-48: Add a workflow component, ui module, and implement it in content moderation bojanz:

Why store the workflow ID inside the bundle info, and bless it as the "one true workflow"? Why not simply have a state_item field type that holds the state, and references the workflow? It would be convenient, and more natural when allowing multiple workflows.
This also makes sense when formatting the state, we currently store only the state ID, but will need to show the state label in various places. There's also a use case for a formatter that renders transition buttons (Jira-style), which would benefit from a field type.

This issue is proposing adding a new FieldType plugin which could be added to any entity which would reference a workflow and store the current state the content is at. The plugin would have formatters and widgets to allow users that can edit the content to transition the state. With pluggable workflow types, this could be used for things beyond moderation.

Right now Content Moderation doesn't use a field type. In #2725533-67: Add experimental content_moderation module , concerns were raised that storing the state of content in a field would have ramifications for installing and uninstalling content_moderation as an experimental module. Thus a computed field was used instead, with a separate entity type for storage. Other issues were raised about the usability of creating a field on an entity vs checking a box on a workflow edit screen.

However, those concerns are no longer relevant because we now have the ability to delete base fields, and therefore uninstall any module which uses a base field, like Content Moderation.

Proposed resolution

Introduce a new workflow_state field type, and use it for Content Moderation in #3057946: Move content moderation information to a base field of the entity being moderated .

Remaining tasks

  • Reviews to finalize the architecture
  • Write test coverage

User interface changes

None.

API changes

A new field type is introduced.

Data model changes

None.

📌 Task
Status

Needs work

Version

10.1

Component
Workflows 

Last updated 3 days ago

Created by

🇵🇱Poland tacituseu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024