How to configure the module?

Created on 24 March 2024, 9 months ago
Updated 14 April 2024, 8 months ago

I'm trying to configure the module and I can't find a way. I explain me:
I have a content type called "Film" and then I have another one called "comment1" (to add short Twitter-style comments about the Film). I have added a link field in the "Film" content with the following text "Add a comment" which links to: "/node/add/comment1?target_id=2". In the "comment1" content I added a reference field with the following prepopulated: target_id: '[current-page:query:target_id]'. In this way, if I access the content "Film" with id=2 and click the link in the field, I access the form for creating a new content "comment1" with the reference field already filled with the title of the content "Film ". Works!
What I can't configure is how to do this automatically for all the "Film" nodes. What do I have to change in " /node/add/comment1?target_id=2" so that it works for any link from any node of this content type? For example, if I access node 12 of "Film" and click on the "Add a comment" link, the form for a new short comment opens with the title of Film added automatically (not just the node with the id= 2, I don't know if I explain myself well).

Can you help me, please?

πŸ’¬ Support request
Status

Needs review

Version

1.6

Component

Documentation

Created by

πŸ‡ͺπŸ‡ΈSpain dcine

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

Comments & Activities

  • Issue created by @dcine
  • Status changed to Needs review 8 months ago
  • πŸ‡ΈπŸ‡°Slovakia coaston

    Hello,

    For this I am using views.
    1.Create entity reference field in Comments content type with reference to Films like you already did and it is called "target_id"
    2.Add EPP like you did to entity reference field > target_id: "[current-page:query:target_id]"
    Note: You can use anything you want so even target_id: "[current-page:query:aaa]" would work and you can use later aaa instead in link.
    3.Create a view with Comments content type
    4.Create relationship with tareget_id field
    5.To Contextual filters add ID with relationship
    6.You can use custom text field or in Header section you can add Global:Text are and put your link there but replace "/node/add/comment1?target_id=2" but "Use replacement tokens from the first row" has to be enabled.
    Replace with :
    "/node/add/comment1?target_id={{ raw_arguments.nid }} "

    7.The same for other fields like customer you can add field to views and update link with anything like :
    "/node/add/comment1?target_id={{ raw_arguments.nid }}&customer={{ field_customer_select }}" where of course EPP has to be added to field_customer_select first like field_customer_select: "[current-page:query:customer]"
    8.If you are using field groups module, you can also add destination anchored to exact field group.

Production build 0.71.5 2024