Problem/Motivation

I get this error in the mercury editor edit page:
Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of core/lib/Drupal/Core/Entity/EntityBase.php).

Mercury editor uses a iframe and i this there is the problem with hreflang.

In hreflang_page_attachments is not check if the varialbe $entity has values.

Issue fork hreflang-3462086

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Carlitus created an issue. See original summary.

carlitus’s picture

Something strange has happened. I created the MR but when I clicked on the link after the push I had no access. I passed it to my partner paucala and he was able to access it.

mfb’s picture

Status: Active » Needs review

This is a bit strange, as this code is more-or-less taken from core Content Translation module. So, you'd think you would also see this error when Content Translation is in use.

However, I can look into trying to reproduce this...

mfb’s picture

I looked into this issue, and found that the code in Content Translation module would trigger the same exception. And so, apparently, Mercury Editor decided to simply disable the hook_page_attachments() implementation for Content Translation module, rather than properly fixing the issue. Therefore, you won't have any hreflang tags provided by Content Translation module if you enable Mercury Editor. So, that seems like bugs that need to be fixed in both Content Translation module and Mercury Editor.

In any case, we can resolve the issue in Hreflang module, at least...

  • mfb committed 89e79c67 on 8.x-1.x
    Issue #3462086 by carlitus, mfb: The "node" entity cannot have a URI as...

mfb’s picture

Status: Needs review » Fixed
mfb’s picture

Actually, looks like Mercury Editor re-implemented the Content Translation hook_page_attachments(), so you do get hreflang links after all. So, just a bug in core Content Translation module I guess.

Status: Fixed » Closed (fixed)

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

carlitus’s picture

Oops, I didn't see this reply, sorry.

Now the patch has failed, but I don't think it's necessary. The Mercury Editor no longer crashes, so it must have been fixed elsewhere.

mfb’s picture

@carlitus this bug was fixed here in hreflang module, and was released in version 1.15

carlitus’s picture

Ok, thanks!