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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel created an issue. See original summary.

swentel’s picture

swentel’s picture

Also, 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.

DamienMcKenna’s picture

Status: Needs review » Fixed
Parent issue: » #2563607: Plan for Metatag 8.x-1.0-beta4 release

Committed. Thanks.

Status: Fixed » Needs work

The last submitted patch, 2: 2634844-2.patch, failed testing.

  • DamienMcKenna committed 6f6ae02 on 8.x-1.x authored by swentel
    Issue #2634844 by swentel: Only load entity meta tags on actual content...
DamienMcKenna’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

stewest’s picture

When 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

DamienMcKenna’s picture

@sideswitch: Are you using the current -dev release or beta3?

Florpunch’s picture

Same 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

swentel’s picture

This fix isn't included in beta3 yet, so you either need to download the dev version or wait for beta4.

glynster’s picture

Ran 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).

glynster’s picture

@swentel I inspected latest dev and it would seem this patch was missed out on the latest release? Once patched works as it should.

DamienMcKenna’s picture

I guess the problem wasn't fixed, then :-\

DamienMcKenna’s picture

Status: Closed (fixed) » Needs work
N1ckN4m3’s picture

Hi,

there is a problem with metatag and contact forms (D8).

unless contact form link is standard contact, all contact form links are broken.

example:

http://mydomain.tld/contact/feedback

=

The website encountered an unexpected error. Please try again later.

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

swentel’s picture

I can't reproduce this, works fine for me here.

tannerjfco’s picture

I was experiencing this issue, updating to the current dev release resolved the issue for me.

DamienMcKenna’s picture

Issue tags: +Needs tests

So lets add some tests to confirm it works.

DamienMcKenna’s picture

Version: 8.x-1.0-beta3 » 8.x-1.x-dev
mr.baileys’s picture

  • Manually confirmed that the problem no longer occurs with current dev (and does occur when the patch from #2 is reverted.
  • Wrote a test to confirm that confirmation.
  • Manually confirmed that the confirmation-confirming test works. Or something.
swentel’s picture

Status: Needs review » Needs work
+++ b/src/Tests/MetatagFieldTest.php
@@ -118,6 +119,16 @@ class MetatagFieldTest extends WebTestBase {
+    $this->drupalGet('contact/test_contact_form');

maybe we should add an assertResponse(200) after ?

DamienMcKenna’s picture

Yes, please add an assertResponse(200) after every drupalGet() call.

DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

Status: Needs review » Fixed

Committed. Thanks mr.baileys!

DamienMcKenna’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.