0

I'm creating a Drupal 8 system where I need commenting to be shared across cloned nodes. When cloning a node the new node is assigned with a new nid, but the title contains the cloned title of the previous node. I was thinking I can use that as a contextual variable to show the shared comments, but I'm unsure of how to go about this.

Or maybe there is better way of solving this approach to display shared commenting?

1 Answer 1

0

There's many routes which to take for this. Drupal 8 gives you a bit more flexibility than previous versions. For the sake of managing a shared comment section, you can go about creating a new body-less content type that only contains:

  • A comment field
  • A node reference field with 2 entries (one for the parent & child cloned node)

Upon your clone operation, you can create a new entity with a dummy, to-be-hidden, title and the node reference field populated with the parent/child nodes.

For display/commenting, you can create a block view that uses a Provide default value: Raw value from url (Path component: 2) (i.e. the node id) contextual filter so the block only displays the shared comment entity on viewing the child/parent nodes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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