In #2848878: Embed Paragraph Content in Normalized Parent Entities (REST), we will add support for inlining paragraphs completely into their host entity as part of serialization.

However, those nested paragraphs might have references, e.g. to files.

This makes the embeded parsing a method that can call itself recursively.

I just saw #2860958: Decompose Importer::importContent() method which does a lot more refactoring and will obviously conflict with this, but it doesn't actually do anything about this specific problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir created an issue. See original summary.

Berdir’s picture

Status: Active » Needs review
FileSize
1.85 KB

Here's a first patch, untested.

Berdir’s picture

If you're wondering, nested _embedded does seem to be supported in the standard according to https://danmessenger.wordpress.com/2014/07/15/haljson-embedded-inside-em...

andypost’s picture

Assigned: Unassigned » larowlan

Imo better to get this in first and later iterate on refactoring

larowlan’s picture

Assigned: larowlan » Unassigned

Looks good.

Should we add some sort of recursion detection? Is it possible that there might be a circular _embedded scenario?

Would be good to get a test in here too, happy to add paragraphs as a test_dependency

Berdir’s picture

This is a plain array parsed from JSON. I'm pretty sure there is no real use case which could have a recursion?

Berdir’s picture

Status: Needs review » Closed (won't fix)

This is no longer required in 2.0.x, the normalization puts all dependencies into the root meta info.