Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When going to contact page with an argument in the URL, the page breaks with following error.
The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Argument 1 passed to Drupal\metatag\MetatagManager::tagsFromEntity() must implement interface Drupal\Core\Entity\ContentEntityInterface, instance of Drupal\contact\Entity\ContactForm given, called in metatag.module on line 217 and defined in Drupal\metatag\MetatagManager->tagsFromEntity() (line 53 of modules/contrib/metatag/src/MetatagManager.php).
To reproduce: install standard, surf to /contact/feedback. Note that /contact is fine.
Comment | File | Size | Author |
---|---|---|---|
#25 | metatag-n2634844-25.patch | 1.11 KB | DamienMcKenna |
Comments
Comment #2
swentel CreditAttribution: swentel as a volunteer commentedComment #3
swentel CreditAttribution: swentel as a volunteer commentedAlso, when going to /contact, there's no title in the title tag, only the site name - but likely unrelated to this - and tricky, this is page which relies on a config entity, which is probably the underlying problem. Should probably be a separate issue.
Comment #4
DamienMcKennaCommitted. Thanks.
Comment #7
DamienMcKennaComment #9
stewest CreditAttribution: stewest commentedWhen going to the url of our (non default) contact/contact_form we get a WSOD.
LOG:
Recoverable fatal error: Argument 1 passed to Drupal\metatag\MetatagManager::tagsFromEntity() must implement interface Drupal\Core\Entity\ContentEntityInterface, instance of Drupal\contact\Entity\ContactForm given, called in /var/www/oursite/public_html/modules/contrib/metatag/metatag.module on line 217 and defined in Drupal\metatag\MetatagManager->tagsFromEntity() (line 53 of /var/www/oursite/public_html/modules/contrib/metatag/src/MetatagManager.php).
We're using: [updated]
Metatag 8.x-1.0-beta3
Drupal 8.0.1
DB: 10.0.23-MariaDB-1~trusty-log
PHP 5.5.9-1ubuntu4.14
Comment #10
DamienMcKenna@sideswitch: Are you using the current -dev release or beta3?
Comment #11
Florpunch CreditAttribution: Florpunch commentedSame issue for me but the personal contact page /contact works well.
Recoverable fatal error: Argument 1 passed to Drupal\metatag\MetatagManager::tagsFromEntity() must implement interface Drupal\Core\Entity\ContentEntityInterface, instance of Drupal\contact\Entity\ContactForm given, called in /modules/metatag/metatag.module on line 217 and defined in Drupal\metatag\MetatagManager->tagsFromEntity() (line 53 of /modules/metatag/src/MetatagManager.php).
Metatag: 8.x-1.0-beta3
Drupal: 8.0.2
Database: 5.5.5-10.1.9-MariaDB
PHP: 5.6.15
Comment #12
swentel CreditAttribution: swentel as a volunteer commentedThis fix isn't included in beta3 yet, so you either need to download the dev version or wait for beta4.
Comment #13
glynster CreditAttribution: glynster commentedRan into the same problem with the latest dev version installed and received the following error:
Recoverable fatal error: Argument 1 passed to Drupal\metatag\MetatagManager::tagsFromEntity() must implement interface Drupal\Core\Entity\ContentEntityInterface, instance of Drupal\contact\Entity\ContactForm given, called in /home/sitename/subdomains/dev/modules/contrib/metatag/metatag.module on line 217 and defined in Drupal\metatag\MetatagManager->tagsFromEntity() (line 53 of /home/sitename/subdomains/dev/modules/contrib/metatag/src/MetatagManager.php).
Comment #14
glynster CreditAttribution: glynster commented@swentel I inspected latest dev and it would seem this patch was missed out on the latest release? Once patched works as it should.
Comment #15
DamienMcKennaI guess the problem wasn't fixed, then :-\
Comment #16
DamienMcKennaComment #17
N1ckN4m3 CreditAttribution: N1ckN4m3 commentedHi,
there is a problem with metatag and contact forms (D8).
unless contact form link is standard contact, all contact form links are broken.
example:
=
if i deactivate metatag module all is fine, but if i activate this module the error above appears (its the one and only error i found).
How can i fix it?
Regards
Comment #18
swentel CreditAttribution: swentel as a volunteer commentedI can't reproduce this, works fine for me here.
Comment #19
tannerjfco CreditAttribution: tannerjfco commentedI was experiencing this issue, updating to the current dev release resolved the issue for me.
Comment #20
DamienMcKennaSo lets add some tests to confirm it works.
Comment #21
DamienMcKennaComment #22
mr.baileysComment #23
swentel CreditAttribution: swentel as a volunteer commentedmaybe we should add an assertResponse(200) after ?
Comment #24
DamienMcKennaYes, please add an assertResponse(200) after every drupalGet() call.
Comment #25
DamienMcKennaThis adds the extra assertResponse().
Comment #26
DamienMcKennaComment #27
DamienMcKennaCommitted. Thanks mr.baileys!
Comment #29
DamienMcKennaClosed a duplicate: #2662168: Metatags seems to be throwing an error on Drupal Contact Forms