Problem/Motivation

Follow-up from #2669978: Migrate D7 Menu Links. The entity URI checking added there relies on the URL structure, which doesn't guarantee an actual entity is accessible via the URI.

Proposed resolution

Adopt a similar approach to the D6 migration.

Remaining tasks

Check and commit

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 2822881-4.patch7.74 KBjofitz
#4 interdiff_2-4.txt1.41 KBjofitz
#2 2822881-2.patch6.33 KBjofitz

Comments

catch created an issue. See original summary.

jofitz’s picture

Status: Active » Needs review
StatusFileSize
new6.33 KB

Having reviewed the changes to the D6 equivalent, LinkUri, it seems there is a lot of overlap and the same process plugin can now be used for both (with minimal tweaks).

Status: Needs review » Needs work

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

jofitz’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new1.41 KB
new7.74 KB

Add a mock node so that the expected entity uri can be generated.

tstoeckler’s picture

+++ b/core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php
@@ -63,6 +63,9 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
+      if ($path == '<front>') {
+        $path = '';
+      }

Missed that detail in the initial D7 patch. I think we should rather use route:<front> in that case, (and skip the internal: stuff in that case. That should be a tad more performant when loading that actual link later.

Status: Needs review » Needs work

The last submitted patch, 4: 2822881-4.patch, failed testing.

jofitz’s picture

@tstoeckler Can you explain what you mean, please? How is route:<front> relevant in this situation?

jofitz’s picture

Status: Needs work » Needs review

Setting back to "Needs review" - appears to have been a test-bot glitch.

mikeryan’s picture

Assigned: Unassigned » mikeryan
tstoeckler’s picture

So, what we end up saving as the link URI matters for the performance of rendering the actual links later in the Drupal site. internal: is the slowest option, but it is used as the fallback as it always work.

That is why we do that dance to try to convert them into entity: URIs as that will make the links much faster to load later on.

And similarly using route:<front> is more performant than internal:/ (or whatever) so we should convert that, as well.

Does that make more sense?

tstoeckler’s picture

Issue tags: +dcmuc16
jofitz’s picture

Thanks, @tstoeckler, that does make sense, but the UI does not handle route:<front> elegantly - it displays the entire string. This goes against the associated text that says simply use <front> (which then gets converted to internal:/).

I suggest committing this "as is" and creating a separate ticket to associate route:<front> with <front> then coming back to change this.

tstoeckler’s picture

Mhhh ... interesting. Yeah, that's fair, I will open a follow-up.

jofitz’s picture

@tstoeckler so would you be happy to set this to RTBC?

tstoeckler’s picture

@mikeryan assigned this to himself 20hours ago, so not sure if he wants to do any improvements or follow-ups, so would like confirmation from him first. But for me this looks RTBC.

tstoeckler’s picture

mikeryan’s picture

Assigned: mikeryan » Unassigned
Status: Needs review » Reviewed & tested by the community

Yep, assigned to myself to review then there was a flurry of activity, so I waited for it to die down.

I'm not particularly conversant with routing, so I defer to @tstoeckler there. The purely migration side looks good to me - I hesitated on seeing a test removed and not replaced, but I see that this test becomes redundant with LinkUriTest, so good to go...

Thanks!

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!

  • catch committed 562a549 on 8.3.x
    Issue #2822881 by Jo Fitzgerald, tstoeckler: Improve Entity URI checking...

Status: Fixed » Closed (fixed)

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

heddn’s picture