Problem/Motivation

For websites that use nested paragraphs, having the parent entity and id is not at all useful. It is typically just another Paragraph entity, and there is no way to see which node the paragraph belongs to.

This module would be way more useful if it had a link to the top-level Host entity instead of just the immediate Parent entity, which can often be a Paragraph entity if using nested paragraphs.

Proposed resolution

Since the top-level host entity cannot be obtained via a simple views query (because it would need to recurse up through the parents to find the host entity) the suggested approach is to create a custom views field and use PHP code to recurse through the parent entities via Paragraph::getParentEntity() until you find a non-Paragraph entity to which the item is attached.

Remaining tasks

User interface changes

In addition to listing the Parent entity type and id, we'll list the top-level Host entity and include a link to that entity, provided that the entity type has a canonical URI. Since Paragraph entities have no canonical URL, this often indicates the Paragraph may be orphaned which will be apparent from the unlinked Parent/Host entity title.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jwilson3 created an issue. See original summary.

jwilson3’s picture

Assigned: Unassigned » jwilson3
Issue summary: View changes
jwilson3’s picture

Title: Show the Host entity instead of Parent Entity ID » Show a link to the Paragraphs' Host Entity

jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

Assigned: jwilson3 » Unassigned
Status: Active » Needs review
nagy.balint’s picture

Thanks!

It worked fine for me.

I think this would be a very good addition to the module.

chrisscrumping’s picture

Patch still works for 1.6 but will need updating for 1.x due to module file change.

Testing on a site and seems like a great adition to the module, would be good to get this merged

man-1982 made their first commit to this issue’s fork.

man-1982’s picture

Status: Needs review » Reviewed & tested by the community

Made some changes and can confirm patch works well.
Thanks

vladimiraus made their first commit to this issue’s fork.

vladimiraus’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

PHPcs is not working.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

vladimiraus’s picture

Status: Fixed » Needs review
jannakha’s picture

Status: Needs review » Needs work

phpcs is still red

vladimiraus’s picture

Status: Needs work » Needs review
jannakha’s picture

Status: Needs review » Reviewed & tested by the community

all green, thank you for your contributions!
please release!

vladimiraus’s picture

Status: Reviewed & tested by the community » Fixed

Thank you all for your contributions. 🎂
Committed.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

  • vladimiraus committed 14ba7aed on 8.x-1.x authored by jwilson3
    Issue #3406566 by marthinal, jwilson3: Show a link to the Paragraphs'...
jwilson3’s picture

Thanks for getting this in! 🎉

Status: Fixed » Closed (fixed)

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