Problem/Motivation

Create a paragraph type with an ER field and use IEF as form display. Add these new type to a paragraphs field in your node. Paragraphs have to be in "preview" mode.

Create a node with one paragraph.

Save the node.

Edit the node.

Add a second paragraph.

Move the second paragraph to top.

Save and you will get the following error:

For the IEF complex widget:

TypeError: Argument 1 passed to Drupal\Core\Field\WidgetBase::massageFormValues() must be of the type array, null given, called in /Users/christianfritsch/Sites/devdesktop/drupal-8.1.9/modules/inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php on line 576 in Drupal\Core\Field\WidgetBase->massageFormValues() (line 505 of drupal-8.1.9/core/lib/Drupal/Core/Field/WidgetBase.php).

For the IEF Simple widget:

TypeError: Argument 4 passed to Drupal\Core\Field\WidgetBase::setWidgetState() must be of the type array, null given, called in /Users/christianfritsch/Sites/devdesktop/drupal-8.1.9/modules/inline_entity_form/src/Plugin/Field/FieldWidget/InlineEntityFormSimple.php on line 173 in Drupal\Core\Field\WidgetBase::setWidgetState() (line 459 of drupal-8.1.9/core/lib/Drupal/Core/Field/WidgetBase.php).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

chr.fritsch created an issue. See original summary.

chr.fritsch’s picture

StatusFileSize
new1.28 KB

I added a patch, that fixed that bug

chr.fritsch’s picture

Status: Active » Needs review
hnln’s picture

Had the same problem, patch solves it.

hoemmawelt’s picture

Same here, patch solves the problem. Thx!

miro_dietiker’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Makes sense.

I understand that people combine these things. But if we want to officially support it, we need a dedicated class.
We need a test_dependency patch first to make testbot support Para + IEF tests.
Then please provide a new class with two methods, one for simple and complex case.

And a short explanation why Paragraphs inside IEF make sense would also be nice. ;-)

hnln’s picture

As for use case, I use a custom entity 'paragraph_settings' that is used by every entity type. It contains some setting fields (title, width, background, ...) that are used by every paragraph type. Using a separate entity is less maintenance then adding these fields individually to each paragraph type. Since each setting entity has a 1-1 relation with a paragraph, the normal entity reference widgets (autocomplete, entity browser, ...) are no use and ief is perfect, the settings fields are directly embedded in the paragraph.

jmuzz’s picture

This is a followup to the related issue in a way. As I understand it this is not about putting paragraph's in IEF it's about putting an ER field using IEF inside a paragraph.

The test dependency and some basic tests for IEF exist already and could be continued to test this case.

I tried the steps in the issue summary with the latest dev version of the modules and Drupal 8.3.x but I wasn't able to duplicate the error. I only tried the simple widget.

Can anybody duplicate this using the latest versions?

miro_dietiker’s picture

Status: Needs work » Postponed (maintainer needs more info)

Ah yeah, IEF inside Paragraphs make perfect sense to deal with references to existing separate entities with option to create a new one.
So if jmuzz can't reproduce, we need more info.

And even if this issue self-resolves, i'm willing to add an IEF test example to make sure things work as expected when combined together.

chr.fritsch’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.94 KB
new3.79 KB

I've added a test to illustrate the problem a bit better

The last submitted patch, 10: saving_problem_in-2804377-10-TEST-ONLY.patch, failed testing.

The last submitted patch, 10: saving_problem_in-2804377-10-TEST-ONLY.patch, failed testing.

jmuzz’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Not sure why I couldn't make the error happen when I tried it before. I manually followed along with what the test did and saw it. The patch causes the node to be saved correctly instead of "The website experienced an error"

chr.fritsch’s picture

@miro_dietiker: Is here something else to do before you can push it?

micbar’s picture

I can confirm that this patch solves the problem.
Could't save paragraphs in preview mode. I have a paragraph type with a media entity (Audio).

pilulu’s picture

The patch in #10 worked for me
Thanks

miro_dietiker’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thx for the hard work and clean test coverage!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

markconroy’s picture

Hi Folks,

I'm presuming this has been applied to the dev branch. Do you have any idea when you might make a new 8.x-1.1 release of paragraphs module to have this available in a stable release?

Thanks.

brooke_heaton’s picture

This is an issue again. Happening to me on Paragraphs 8.x-1.11.