I want to appended a registration form to a node-type. So far, I am able to append a form like this:

  1. Create a new form: /admin/structure/contact
  2. Add a new field to the content type:
    Field type: 'Reference - other...'
    Choose 'contact form' in the second step.
  3. Change 'label' to 'rendered entity' in 'manage display' settings.

This works as expected. However, I want to send the form to the author of the node - not a predefined recipient in the form settings. Additionally, I need to include a link to the node from which the form has been sent.

Any ideas?

Comments

VM’s picture

investigate the rules module for sending to author
investigate a custom tpl.php for the form with your logic to print a link if rules doesn't already cover it

piridium’s picture

Thanks VM. I will check if rules is of any help. I don't know it very well yet and I got the impression it's a pretty mighty but complicated module.

Regarding tpl.php, please note that the question was asked for D8. I don't think I can add this functionality in a twig-template.

I already tried it with a custom module and hook_mail_alter. I can change the 'to' there, but have no idea how to get the mail-adress of the node author. Any hints are highly welcome. :-)

piridium’s picture

The client decided for another solution for registration which is far more easy to implement. Thanks anyway!