Paragraph integration

Created on 15 June 2017, over 7 years ago
Updated 8 August 2023, over 1 year ago

As paragraph becomes a major module in drupal 8, it could be nice to allow CER to handle it.
Here is, I think, the main use case:

I will use the movies and the people involved them to make more clear my asking:

There is a movie content type, and in a movie you would like to encode all the peoples involved in it : field_movie_persons
Persons is also a content type, and for a person you would like to encode all the movies in which he participated: field_person_movies

At this point, CER is doing a great job: if you link field_movie_persons and field_person_movies you will get a nice "reciprocal auto completion".

Now, we would like to create a taxonomy vocabulary named "roles": Film maker, actor, producer,...
(We also delete the 2 fields field_movie_persons and field_person_movies)

And in the movie, we would like to encode a person AND a role: Tom Hanks + Actor
Reciprocally, in the Tom Hanks's form, we would like to encode a movie AND a role: Forest Gump + Actor

Assuming we will use Paragraph to create those 2 "grouped" fields, we can't manage it in CER.

Paragraph type 1: field_para_movie_and_role (contains: field_mr_movie et field_mr_role) =>Forest Gump + Actor
Paragraph type 2: field_para_person_and_role (contains: field_pr_person et field_pr_role) =>Tom Hanks + Actor

To make it work in CER, we should create a UI:

1)To choose 2 corresponding paragraph type [+/- like the existing UI for the corresponding field]
=>here it would be field_para_movie_and_role and field_para_person_and_role

2)To choose the "Key(s)" of the Paragraphs types.
=>Here, it would be field_mr_movie and field_pr_person

3)To map the remaining fields between the 2 corresponding paragraph type
=>Here we would map field_mr_role with field_pr_role

Process when updating a movie/role in a person form: Tom hanks => Actor in Forest Gump

1-The key field will be used to find the corresponding entity to update: field_mr_movie will contains the id of the film to update (Forest Gump)
Note: we could choose 2 keys field: In our story, it will allow, for exemple, to encode twice the same person for a movie but with 2 different roles (Film maker and actor)... But I will continue the explanation with a unique key

2-We will store all the "not key" values in an array
=>Here, we have only one value: the role (=Actor)

3-The Id of the edited person will be used to update the movie: In forest Gump, we can look if Tom Hanks exists (to update it or to add it) and, by using the mapping fields, we can set the "Actor" value

Thank you

✨ Feature request
Status

Needs work

Version

5.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium DuneBL

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States dalemoore

    I'd be interested in this as well. My use cases are for scholarships and awards. I want to be able to use a Paragraph of "Award" with a field of year (date) and a field for the award (a content type, Award). Then use CER to create a two-way relationship, so that on my Person content type I can add an Award paragraph with the year and award(s) that individual won, but also on the dedicated award's page list all recipients of the award and the year won. There may be a way to do this w/o CER + Paragraphs but using Paragraphs makes it much more easier to add it to the Person content only when needed.

  • πŸ‡¬πŸ‡§United Kingdom jonathanshaw Stroud, UK

    on my Person content type I can add an Award paragraph with the year and award(s) that individual won, but also on the dedicated award's page list all recipients of the award and the year won.

    I don't think you need CER for this. Paragraphs already store their parent in a field, you should be able to show it in a views listing.

  • πŸ‡ΊπŸ‡ΈUnited States dalemoore

    Yep, you're right as I just discovered. πŸ˜‚ This happens to me so often... I'll try and try to figure something out, finally give up, find a post somewhere with a similar problem, post... then minutes later, figure out something. I wasn't going to use Views, but Views works, so Views it is.

  • πŸ‡©πŸ‡ͺGermany demonde

    I don't think you need CER for this. Paragraphs already store their parent in a field, you should be able to show it in a views listing.

    Yes, but the views relationship handler does not work correctly.

Production build 0.71.5 2024