When using the Core content moderation module on a Media bundle which is create-able via the Entity Browser IEF widget, the following error is thrown:

Fatal error: Call to undefined method Drupal\entity_browser\Form\EntityBrowserForm::getEntity() in /.../docroot/core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php on line 219

Relatively tricky issue as the form itself isn't a ContentEntityForm, and the there could potentially be multiple IEF widgets attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered created an issue. See original summary.

imen ch’s picture

I have the same error when i use content_moderate with RNG module..

Fatal error: Call to undefined method Drupal\rng\Form\EventSettingsForm::getEntity() in C:\xampp\htdocs\drupal2\core\modules\content_moderation\src\Plugin\Field\FieldWidget\ModerationStateWidget.php on line 219

a-fro’s picture

This is an issue with the paragraphs module as well. See issue 2848259.

When targeting a single paragraphs bundle with the ief widget, it mostly works (with bugs). However, if you are targeting an entity that has a paragraphs field, this error is triggered.

a-fro’s picture

Category: Task » Bug report
rutiolma’s picture

Same problem using workbench moderation

validoll’s picture

Status: Active » Needs review
FileSize
3.32 KB

Faced with same issue when use options field.

Fixed it via patch. (for 1.3)

Status: Needs review » Needs work
bas123’s picture

I am tryng to configure Moderation for my site. Drupal 8.4.2
I installed the various (latest) Workbench and Moderation Modules and found it wasn't fully configured.
In going through the helpful videos (Created for Drupal v7.x) I got to the stage where you enable moderation on the content type you are working with
While adding a moderation state for Posts:
I got to the screen:
Home/Administration/Structure/Content types/Post
-----------------------
Which has the following:
Enable moderation states.
Content of this type must transition through moderation states in order to be published.
Allowed moderation states (Unpublished)
- Archived
- Draft
- Needs Review
The allowed unpublished moderation states this content-type can be assigned.
Allowed moderation states (Published)
- Published
The allowed published moderation states this content-type can be assigned.
Default moderation state
- Draft
Select the moderation state for new content
[Save] Delete
----------------------------
I clicked on the "Save" Button
and this fatal error resulted:
Fatal error: Call to undefined method Drupal\content_moderation\Entity\Handler\NodeModerationHandler::onBundleModerationConfigurationFormSubmit() in /home/MYSITE/dev/site/modules/workbench_moderation/src/Form/BundleModerationConfigurationForm.php on line 184
Any thoughts?

samuel.mortenson’s picture

Issue tags: +Needs reroll
marcoscano’s picture

Maybe the best next step here would be to have clear steps to reproduce.

I've just done this:
- Core 8.6.x-dev
- Enable -dev versions of: entity_browser, content_moderation, paragraphs, inline_entity_form, ctools, entity_browser_entity_form (and their dependencies)
- Create a paragraph type with a text field
- Add a paragraph field to the Page content type
- Create an EB with the following config: Modal, Tabs, No selection. Add a IEF widget to create nodes of type Page
- Add an entity reference field to Articles, pointing to Pages. Set its widget as EB, select the browser created before
- Enable both Articles and Pages as moderatable content
- Open the node Article form, then open the EB widget to create a Page. Save the page inside the modal.
- Boom

However, the error I get is a different one:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'langcode' cannot be null: INSERT INTO {paragraphs_item} (revision_id, type, uuid, langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => text [:db_insert_placeholder_2] => 22ee8d48-7a1b-4208-8158-ab40cda065a4 [:db_insert_placeholder_3] => ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 850 of /var/www/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Which makes me wonder if this may have been fixed in the latest versions, and the only remaining bug is #2901390: Integrity constraint violation: 1048 Column 'langcode' cannot be null, which is a paragraphs one?

Or maybe I'm testing it wrong? Let me know if that's the case.

Thanks!

a-fro’s picture

Confirmed. I just reproduced the same error locally, which the paragraphs patch mentioned above fixes. It appears this issue has been resolved.

marcoscano’s picture

Status: Needs work » Closed (outdated)

Great, thanks for testing @a-fro!

Closing this for now then, anyone please feel free to re-open if we have steps to reproduce.