0

I was looking without luck for a way to be able to make a link or button with the functionality of making a new content showing some content or comment already posted above, something like the Retweet option to be more clear.

Is there a module or combination of modules to achieve this?

Edit:

Now after an answer I know it is easily rendered with a reference field, all I need now is a way to create a link that will auto fill the reference field. That way the user clicking the link never see the field, my idea is that that field is not visible in 'Manage form display'.

Edit 2:

Prepopulate module do the desired link. If I disable the field on 'Manage form display' it stop working. So I used Popup field group

As I told in the comments, this module makes a Popup with only desired fields, but instead doing it, no Popup is opened and the form is rendered with all the fields except the ones supposed to appear on the Popup, so I use the module to get my reference field only on the Popup group and that way this field disappear on create or edit content. Because I am solving this taking advantage of a module that did not do correctly what it should do, if someone thinks that this solution is not a safe way to do it let me know other way to achieve it.

1

You can use an Entity Reference field. In Drupal, most of the "content" that you see, including nodes and comments, are entities.

Entities can be linked to each other with an Entity Reference field.

Here's a tutorial video.

One challenge when working with Entity Reference is that each field can only reference one type of entity-- so you can have an Entity Reference field for nodes, or for comments, but not both at the same time; to have both, you need two fields.

Out of the box, Entity Reference can be configured to select the content by autocomplete or by a select list, which can be the output of a view you have customized, so it's quite flexible.

3
  • Thank you! I was able to render it, but now I got to see how to make a link that auto-fill the ID of the Content or Comment to automatize it. The idea is to make that field not visible in 'Manage Display Form' so the user only have to click that link to reference it.
    – MrIssue
    Feb 17 at 1:11
  • 1
    The Prepopulate module will let you pre-fill the form based on the query string, but if you want to hide the field and fill it in automatically, you'll need to write custom code. drupal.org/project/prepopulate Feb 17 at 2:45
  • With Prepopulate I was able to do the desired link. Because I can't hide it of 'Manage form display', I installed [Popup field group] (drupal.org/project/popup_field_group) Its funny because popups are not working and the fields added to it dissapear from the form, so I added the reference field to the Pop up group and done! Now my form its not displaying it. Thanks for pointing me to the right direction, I mark your answer as solved :) If someone thinks that last fix with Popup is not recommended let me know
    – MrIssue
    Feb 17 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.