The website encountered an unexpected error. Please try again later.
Error: Call to a member function id() on null in Drupal\contact\MessageForm->form() (line 149 of core/modules/contact/src/MessageForm.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | contact_formatter-prevent_error_if_personal-3017452-9.patch | 882 bytes | albertski |
Comments
Comment #2
chris matthews commented@hop, can you provide the steps necessary to reproduce this issue?
Comment #3
hop commentedError: Call to a member function id() on null in Drupal\contact\MessageForm->form() (line 149 of core/modules/contact/src/MessageForm.php).
Comment #4
albertski commented@hop, When viewing the form on the actual contact form page (not your node), do you get an error as well?
Comment #5
hop commentedContact form (URL: /contact and /contact/feedback) is OK. Contact form in node is OK too. Problem is only in Node with field Personal contact form.
Comment #6
albertski commented@hop I was able to replicate this issue. It only happens on the Personal Contact form. When you use a different form instead of the Personal Contact form do you still get the error?
Comment #7
hop commentedNo, only when I use Personal Contact form.
Comment #8
albertski commentedFor some reason, if you load the personal contact form it does not have
$message->getPersonalRecipient(). I created this issue: #3018881: Can't load personal contact form. For now, I created a patch to not load if personal form but the downside is that it will be confusing to the user because nothing will print out.Comment #9
albertski commentedRerolling patch.
Comment #10
chris matthews commentedThe patch in #9 applied cleanly to ContactFieldFormatter.php and after going through the steps to reproduce fixes this issue for me. @hop, can you confirm the same?
Comment #11
hop commentedThe patch #9 is OK, thanks. Can you update "stable release"?
Comment #13
albertski commentedPatch has been pushed to dev.
Comment #15
w01f commentedI can't get this module to work.
The contact form refuses to show on the user page. Any suggestions greately appreciated!
Comment #16
albertski commented@WOLF are you using a Personal Contact form? If so that may be the issue. I mentioned above the patch only prevents the error but it will be confusing because nothing will print out. Try to create another form. Having said that I never tested this on the user entity but don't think that will cause any issues.
Comment #17
seaneffel commentedConfirming #15 that custom contact forms are rendered on the user entity but personal contact forms are not. This would be a superior module for placing contact forms on entities if this little detail worked as implied.