After migration from wbm 2 content moderation when I click on node edit I am getting ModerationStateFieldItemList::referencedEntities() not found error.
Error: Call to undefined method Drupal\\content_moderation\\Plugin\\Field\\ModerationStateFieldItemList::referencedEntities() in /Users/kumsu25/Sites/devdesktop/docops-upgradedbase/docroot/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/EntityReferenceAutocompleteWidget.php on line 88 #0 docops-upgradedbase/docroot/core/lib/Drupal/Core/Field/WidgetBase.php(322): Drupal\\Core\\Field\\Plugin\\Field\\FieldWidget\\EntityReferenceAutocompleteWidget->formElement(Object(Drupal\\content_moderation\\Plugin\\Field\\ModerationStateFieldItemList), 0, Array, Array, Object(Drupal\\Core\\Form\\FormState)), referer: https://docops-upgradedbase.dd:8443/de-de/node-1597-integrations
drupal version : 8.4.3 has
class ModerationStateFieldItemList extends FieldItemList {
}
drupal version : 8.2.x has
class ModerationStateFieldItemList extends EntityReferenceFieldItemList {
}
I got error in drupal version : 8.4.3 .
When I try to access /admin/structure/types/manage/story/form-display
stderr: Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException: "The "" entity type does not exist." at /Users/kumsu25/Sites/devdesktop/docops-upgradedbase/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php line 133.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 2933745-10.patch | 5.64 KB | phenaproxima |
| #7 | 2933745-7.patch | 1.8 KB | nikunjkotecha |
Comments
Comment #2
flutterstack commentedComment #3
flutterstack commentedComment #4
david.gil commentedsame here.
Comment #5
jmoreira commentedI am also having this issue when creating new content types and blocks that don't need to be moderated. This seems happen because the class Drupal\content_moderation\EntityTypeInfo adds the moderation state field to all entities that can be moderated regardless if selection for moderation for an specific bundle(see function entityBaseFieldInfo). I would gladly work on a patch but I'm not sure what the best solution would be.
An intermediary solution that got my site working again was to delete all the config files for the bundles I don't want moderation on and run drush cim.
Example:
Comment #6
nikunjkotechaThanks for the findings @jmoreira.
I had to do one more step to ensure it works fine (since we were not using full config import / export). Added the code in drush command itself.
Comment #7
nikunjkotechaUpdated patch to handle exceptions for entity types not supporting base field definitions call.
Comment #8
phenaproximaGreat catch, great patch! I want to merge it, but I can't do that until this change is also implemented in the Drush 9 variant of the command. Additionally, this will need tests.
Comment #9
phenaproximaComment #10
phenaproximaRefactored the patch to work with Drush 9 and Drush 8. It will also delete the base field overrides *before* installing Content Moderation, not afterwards. If anyone can give this a quick manual test, it would be heavily appreciated!
Comment #11
lahoosascoots commentedWorks great only if all entity types are fieldable. To account for non-fieldable we can pop this at line 161 of MigrationController
Comment #13
phenaproximaCommitted and pushed. Thanks!