Problem/Motivation

The process plugin link_uri is in namespace Drupal\menu_link_content\Plugin\migrate\process\d6 but it is used in menu_links.yml, which is tagged for both Drupal 6 and Drupal 7.

Proposed resolution

Move LinkUri.php to Drupal\menu_link_content\Plugin\migrate\process.
Move LinkUriTest.php to Drupal\Tests\menu_link_content\Unit\Plugin\migrate\process.

Remaining tasks

Make a patch.

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone created an issue. See original summary.

Hardik2309’s picture

Assigned: Unassigned » Hardik2309
Hardik2309’s picture

Assigned: Hardik2309 » Unassigned
Status: Active » Needs review
FileSize
3.08 KB

Adding patch as suggested.

Status: Needs review » Needs work

The last submitted patch, 3: plugin_link_uri-2816857-3.patch, failed testing.

quietone’s picture

@Hardik2309, welcome to migrate! Thank you for the patch.

If you look at the errors it reports, 'The "link_uri" plugin does not exist.'. That makes sense since the patch deletes the file instead of moving it. It needs to move from ./core/modules/menu_link_content/src/Plugin/migrate/process/d6/LinkUri.php to /core/modules/menu_link_content/src/Plugin/migrate/process/LinkUri.php. And then correct the 'Namespace' declaration in the LinkUri.php.

You can run the tests locally with something like this:

vendor/bin/phpunit -c core --debug -v --colors=always core/modules/menu_link_content/tests/src/Kernel/Migrate/d7/MigrateMenuLinkTest.php

And the handbook has more info about running PHPUnit tests. Apologies if you already aware of that.

Hardik2309’s picture

Status: Needs work » Needs review
FileSize
3.08 KB

New patch added as suggested.Kindly ignore the previous patch.

Status: Needs review » Needs work

The last submitted patch, 6: plugin_link_uri-2816857-6.patch, failed testing.

hussainweb’s picture

Fixing the patch in #6. Actually, this was a completely new patch as it was an easy task.

This was done in a live demo on Drupal contributions webinar.

Status: Needs review » Needs work

The last submitted patch, 8: process_plugin_link_uri-2816857-8.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review
FileSize
2.58 KB

Moving test as well.

Status: Needs review » Needs work

The last submitted patch, 10: process_plugin_link_uri-2816857-10.patch, failed testing.

hussainweb’s picture

Status: Needs work » Needs review

Random failure

quietone’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Thanks for moving the test as well! I did forget to put that the in the Issue Summary. It is added now.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Should we add a temporary bc layer here in case someone is subclassing the plugin? Otherwise this can only go into 8.2.x

hussainweb’s picture

I understand your concerns, but I think it's highly unlikely that someone might be doing that.

phenaproxima’s picture

Status: Needs review » Needs work

I think @catch raises a good point. It's highly unlikely anyone is subclassing it, but this is Drupal, everything is overridable, and we can't be certain. This is a good task for a novice -- let's keep LinkUri outside the d6 namespace, but put a subclass of it in the d6 namespace and mark it deprecated.

The deprecation text should be something like this:

@deprecated in Drupal 8.2.0, will be removed before Drupal 9.0.0. Use \Drupal\menu_link_content\Plugin\migrate\process\LinkUri instead.
Ada Hernandez’s picture

Status: Needs work » Needs review
FileSize
12.95 KB

Hi everyone, I made a patch where added the message for Drupal\menu_link_content\Plugin\migrate\process\d6\LinkUri like @deprecated.

Ada Hernandez’s picture

I have fixed the previous patch.

phenaproxima’s picture

Status: Needs review » Needs work

Except for these two things, looks good to me. Thank you, @Adita!

  1. +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/d6/LinkUri.php
    @@ -9,76 +9,16 @@
    +use \Drupal\menu_link_content\Plugin\migrate\process\LinkUri as OtherLinkUri;
    

    "OtherLinkUri" got a smile from me, but it's kinda vague-sounding; can we import it as BaseLinkUri or DeprecatedLinkUri?

  2. +++ b/core/modules/menu_link_content/src/Plugin/migrate/process/d6/LinkUri.php
    @@ -9,76 +9,16 @@
      * @MigrateProcessPlugin(
      *   id = "link_uri"
      * )
    

    This should be removed.

Ada Hernandez’s picture

Status: Needs work » Needs review
FileSize
15.46 KB
1.01 KB

@phenaproxima thanks for your commentaries I got better

tstoeckler’s picture

Can someone explain how this is related to #2669978: Migrate D7 Menu Links and #2822881: Improve Entity URI checking in menu link migration?

The first one introduced a separate uri plugin for the D7 menu link migration and the second one was opened to consolidate that with the D6 version or at least bring it into feature parity.

I don't really understand that in light of this issue, to be honest.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

re #21: this is a quick fix to move the class into a non-drupal versioned namespace. When #2669978: Migrate D7 Menu Links went in, it didn't fix the namespace. We'll improve things even more in #2822881: Improve Entity URI checking in menu link migration, but let's get the simple namespace issue fixed first.

#19 is fixed.

tstoeckler’s picture

Ahh, this is just a rename, I understand. In these cases it's nice to create patches with -C -M, so that is more clear. Thanks anyway for the explanation!

heddn’s picture

Re-rolled patch. No changes so I'm leaving this at RTBC.
(8.2.x) $ git diff --cached -M >process_plugin_link_uri-2816857-24.patch

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for maintaining BC - the patch looks good - just one small thing:

+++ b/core/modules/menu_link_content/src/Plugin/migrate/process/d6/LinkUri.php
@@ -9,76 +9,13 @@
+use \Drupal\menu_link_content\Plugin\migrate\process\LinkUri as DeprecatedLinkUri;

This looks weird - the name 'DeprecatedLinkUri' is being used for the thing that is not deprecated :) - How about just calling it RealLinkUri?

hardikpandya’s picture

Status: Needs work » Needs review
FileSize
15.45 KB
904 bytes

Changed DeprecatedLinkUri to RealLinkUri.

heddn’s picture

Status: Needs review » Reviewed & tested by the community

And ready again.

  • catch committed 957997d on 8.3.x
    Issue #2816857 by Adita, hussainweb, Hardik2309, hardik.p, heddn:...

  • catch committed a9ed7cd on 8.2.x
    Issue #2816857 by Adita, hussainweb, Hardik2309, hardik.p, heddn:...
catch’s picture

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

Fixed unused use statements on commit.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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