Ability to set moderation state during cloning

Created on 6 March 2024, 8 months ago
Updated 8 August 2024, 3 months ago

Problem/Motivation

The current interface has a checkbox for whether or not the cloned entity should be published. This interface is not sufficient for sites using Drupal core's content_moderation and workflows modules for two reasons:

1. The existing code hardcodes the moderation state published. This machine name state cannot be assumed to be present on all workflows.
2. Drupal content moderation is designed to have multiple states that can correspond to "published" or "unpublished" status. No single checkbox can represent which of the possible moderation states should be used.

This could also be characterized as a "bug" under a certain not-uncommon configuration: if a site's workflow's default_moderation_state is "Published," a user indicating that the cloned entity should not be published can *still* end up with a published clone, since the default moderation state is used.

Proposed resolution

If a site is using content_moderation, find the workflow associated with the entity type and provide a select option for the user to choose the target moderation state. The default option should match the state of the clonee.

If not, use the existing "published/unpublished" checkbox.

Acceptance criteria

  • If multiple languages are configured on the site, there is no change to the entity clone form (this preserves existing behavior that will set all cloned translations to "draft")
  • Otherwise, if content moderation is enabled for an entity, instead of showing a single published/unpublished checkbox, the clone form provides an interface to choose the moderation state of the clone
  • The list of selectable moderation states is determined by the current user's permissions for workflow transitions
Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States mark_fullmer Tucson

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024