Default to published on certain entity types

Created on 24 February 2025, 7 months ago

Problem/Motivation

When cloning it is possible to also publish the cloned entity, but there are some situations where it is preferred to force them as published to prevent mistakes.

For example when cloning custom blocks (from block_content), if the published box is not checked, they go into an unpublished state and cannot be published (there is no form element for custom block publish).

As a workaround the form could just be modified with a form_alter.

(There is a core issue that will allow custom blocks to be published: #2834546)

Steps to reproduce

1. Create a custom block, clone it and leave it unpublished
2. Add the block to something like layout builder
3. View as anonymous, block is not visible

Proposed resolution

Allow configuration of default published status on a per-entity (?) level.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States djdevin Philadelphia

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

Comments & Activities

  • Issue created by @djdevin
  • 🇺🇸United States DigantDj

    We ran into the same issue after Drupal core & module update, this will definitely. It would be helpful to solve for even if not at the per-entity level, at least at the root level for someone who wants to keep the legacy behavior of publish by default.

  • 🇸🇮Slovenia deaom

    I'm not sure I understand the issue (or maybe it was solved in the meantime). When I go to clone a content block, there is the option of "Save cloned Content block as published", if that is checked the cloned block is published. The core is handling the publish/unpublish checkbox field (status is there, just not added to UI). If the checkbox is not checked when cloning, once the core issue will be merged, the status will be possible to update/change, until then, don't think this falls under this module as the status can be updated in code for the specific block (or block can be removed and cloned again with the publish option checked).

Production build 0.71.5 2024