Paragraphs & workspaces - stage to live results in unpublished paragraphs.

Created on 10 February 2022, almost 3 years ago
Updated 19 September 2023, about 1 year ago

Problem/Motivation

Drupal 9.3.5 / with core workspaces: Paragraphs added to a node on the stage workspace when published to the live workspace become unpublished.

Steps to reproduce

  1. Install workspaces
  2. switch to stage workspace
  3. create new node
  4. add paragraph to new node [the paragraph I had in testing was just a title and long text
  5. save node
  6. stage version shows paragraph content as published
  7. publish to live
  8. live version shows paragraph content as unpublished

The live version of the node can then be edited to have each unpublished paragraph published [once the edit form has been edited to include this option]. Is there a way of making paragraphs published by default?

If paragraphs are added on the live version of the node, edited in the stage workspace, then pushed to live, the paragraph remains published.

💬 Support request
Status

Active

Version

1.12

Component

Miscellaneous

Created by

🇬🇧United Kingdom ice70

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

Comments & Activities

Not all content is available!

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

  • 🇧🇪Belgium mgoubert

    In our case it was more useful to keep the paragraph publish option as set on de workspace staging environment:

    Patchode:

    Index: modules/workspaces/src/EntityOperations.php
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/modules/workspaces/src/EntityOperations.php b/modules/workspaces/src/EntityOperations.php
    --- a/modules/workspaces/src/EntityOperations.php	
    +++ b/modules/workspaces/src/EntityOperations.php	(date 1695131137587)
    @@ -149,12 +149,15 @@
         // - An unpublished default revision in the default ('live') workspace.
         // - A published pending revision in the current workspace.
         if ($entity->isNew() && $entity->isPublished()) {
    -      // Keep track of the publishing status in a dynamic property for
    -      // ::entityInsert(), then unpublish the default revision.
    -      // @todo Remove this dynamic property once we have an API for associating
    -      //   temporary data with an entity: https://www.drupal.org/node/2896474.
    -      $entity->_initialPublished = TRUE;
    -      $entity->setUnpublished();
    +      // Custom patch
    +      if ($entity->getEntityType()->id() != 'paragraph') {
    +        // Keep track of the publishing status in a dynamic property for
    +        // ::entityInsert(), then unpublish the default revision.
    +        // @todo Remove this dynamic property once we have an API for associating
    +        //   temporary data with an entity: https://www.drupal.org/node/2896474.
    +        $entity->_initialPublished = TRUE;
    +        $entity->setUnpublished();
    +      }
         }
       }
     
    
Production build 0.71.5 2024