Problem/Motivation
When attempting to use Paragraphs with the Content Moderation module, it seems that the field moderation_state is added to the Paragraph.
That field should be able to be removed without harming the functionality of Paragraphs itself.
Proposed resolution
Attempt to remove that field and see if the module works normally.
Comments
Comment #2
johnchqueAdding patch combined with the one in #2951436: Fix integration with content moderation in multi-lingual scenarios. :) Will need to check how to ensure running the tests with the update applied.
Comment #4
johnchqueAdding patch with the differences with the combined.
Comment #5
johnchqueThis should work. Gonna test better.
Comment #6
johnchque#novicefail :)
Comment #7
berdirYeah, like that.
We already have a content translation test for the non-translation use case (currently hiding in paragraphs_library). This still passes, so that's good. Lets extend that by making sure that it is not possible to select paragraphs in the workflow UI.
Comment #8
johnchqueAdding basic tests. :)
Comment #11
johnchqueTrying simplifying the tests.
Comment #13
johnchqueThanks to @Berdir could run my tests locally again, this passes locally, let's try it out. :)
Comment #15
berdirThe comment can be improved a bit, but we can do that on commit I'd say.
The field is a side effect, the main point is that we do not want to support applying content moderation directly to paragraphs but only through the host.
Comment #17
miro_dietikerCommitted with an improved comment.
Comment #19
mpp commentedAfter reinstalling I got this notice:
Followed by this error:
Removing these files should solve this issue:
core.base_field_override.paragraph.*.moderation_state.ymlComment #20
johnchqueI just tested this again with Drupal 8.6.1 and latest Paragraphs, I cannot reproduce what you described, @mpp, what core version are you using?
Is there any extra step we should consider besides just reinstalling? Was it when reinstalling Paragraphs or Paragraphs demo?
Comment #21
berdir@mpp left out that he is using config_installer with existing configuration. This can also happen when updating existing sites, see #3005263: Add upgrade path for sites that have existing base field overrides for moderation_state field.
Comment #23
sam152 commentedI am attempting to fix the root cause of this issue here if anyone would like to review it: #2915383: The moderation_state base field is added to all revisionable entity types even if they do not have moderation enabled.
Comment #24
frederickjhI believe I have run into an issue with this code not being able to do its job to remove the fields.
I am working on updating a Drupal site that is currently on 8.7.5 and was preparing to upgrade to version 8.8 when I realized that paragraphs was pinned to version 1.2. Looking through the releases I saw that version 1.10 says "Compatibility with Drupal 8.8" so I though it would be good to upgrade to at least that version of paragraphs before upgrading Drupal core.
Attempts to upgrade to versions 1.10 and then later to 1.5, 1.3, and 1.4, resetting the develop environment before each attempt, gave the same result. The site status report contained the following error:
Running
drush entity-updatesseems that everything goes okay as no error is return but the status report error remains and running `drush entity-updates` again in finds the same fields to remove.I am not sure if this has to do with the fact that in Drupal version 8.7 support for automatic entity updates was removed. I tried downgrading the Drupal version to just below 8.7 but there have been too many changes to the database and a number of errors are returned when trying to run
drush entity-updatesand it just exits.The other curious thing that I noticed is that the error message "finds" four fields to remove but the last two do not have their names in the error message. This is more evident in the terminal as there you see the double spaces (one on either side of the empty variable) where as in the Status Report in the HTML his is reduced to one space.
I could not figure out from the patch code which fields need to be removed. If anyone can give my a push in the right direction as to how to remove these fields even if that means removing them manually from the database, I would appreciate it.
In looking at the database I noticed what looks like a revisions table for each field used in paragraphs these all start with
paragraph_revision__field_followed by the machine name of the field. I have to wonder if these can also safely be removed as there are quite a few.