Problem/Motivation
Migrate Linkit profiles from Drupal 7
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | interdiff-12-15.txt | 2.59 KB | omkar.podey |
| #15 | migrate_linkit_profiles-3238951-15.patch | 17.1 KB | omkar.podey |
| #8 | migrate_linkit_profiles-3238951-8.patch | 16.85 KB | omkar.podey |
| #5 | migrate_linkit_profiles-3238951-5.patch | 7.12 KB | narendrar |
| #4 | d9_matchers.png | 215.99 KB | omkar.podey |
Comments
Comment #2
narendrarPatch attached
Comment #3
omkar.podey commentedComment #4
omkar.podey commentedManual testing done , the patch successfully migrates linkit data form d7 to d9.
Attached screenshots.
Comment #5
narendrarCode updated with necessary migration dependencies
Comment #6
wim leersWe also need a migrate lookup for
d7_node_type, because they could be renamed from the source to the destination.Comment #7
narendrarThanks Wim for review.
Attached is the updated patch.
Comment #8
omkar.podey commentedComment #9
wim leersLooking good! I have a bunch of coding style-related remarks for you, @omkar.podey 😅🤓
You can make this a class-level property.
See
\Drupal\Tests\content_translation\Kernel\ContentTranslationHandlerTestfor an example.Then you can do
$this->entityTypeManager. That is slightly cleaner.We never use
/* … */style comments in function bodies. Can you convert these to//-style comments? 🤓🙏Nit:
$this->assertCount(2, $profile_types);would be even simpler!Nit: we use camelCased class method and class property names, but underscored names everywhere else. That also means all variable names in function bodies should use underscores, so this would become
$linkit_profile.Übernit: we don't allow a newline just before the closing brace.
Nit:
$this->assertTrue()would be simpler.Nit:
assertEquals()is an equality (==) check. It's always safer to be stricter (===), and hence to useassertSame()whenever possible.Same here.
Comment #10
omkar.podey commentedUpdated as per Wim's review .
Comment #11
wim leersI'd like to see this moved to a helper method, that'll make the code much easier to read.
And this too should be moved to a helper method.
In newer versions of PHP this will yield an error, because this is an inherited class property we're overriding — and the parent one uses
protected. We should use the same visibility here.Nit: it's great that we're assigning it like this, but
protected $entityTypeManageris not specified like\Drupal\Tests\content_translation\Kernel\ContentTranslationHandlerTest::$entityTypeManageris.Nit: these could use
===checks 🤓These still have the extraneous newline before the closing brace — let's remove them :)
Comment #12
omkar.podey commentedUpdated as per review .
Comment #13
omkar.podey commentedComment #14
wim leersNice! Deduplicated code! 🥳
Missing docblock documenting the various parameters (
@param) and return value (@return).Also missing typehints.
Why modify
$matcher_valueby reference? When possible, avoid modifying by reference, and prefer return values. That makes it easier to understand, and also easier to test :)Comment #15
omkar.podey commentedUpdated as per review.
Comment #16
omkar.podey commentedComment #17
wim leersPerfect! 🤩
Comment #18
johnwebdev commentedHow can I easily test this manually?
Comment #19
wim leersApply this patch, install
migrate_tools, then rundrush migrate:import d7_linkit_profiles😊Comment #20
mark_fullmerFor some time now, as indicated by the Linkit project page, the 8.x-5.x branch of Linkit is not undergoing active development. It is also only compatible with unsupported versions of Drupal core (Drupal 8 and Drupal 9).
To help the maintainers of the Linkit module better steward tasks under active development, I'm going to mark this issue as closed (wontfix). Sites using 8.x-5.x can certainly continue to do so, but should make plans for updating to the latest supported version of Linkit.
Even better: Drupal core will soon provide link autocomplete suggestions in CKEditor similar to what this module does. Sites using or considering using Linkit should follow this core issue to evaluate whether they can use the core solution instead of Linkit. See feature differences below to compare what Linkit includes that will not initially be in Drupal core.
If this issue relates to a problem or feature request that is applicable to the latest supported version of Linkit, please create a new issue, associated with that branch, describing the bug or enhancement.
For participation and information in Linkit's roadmap, see #3345480: LinkIt Release Roadmap and Issue Prioritization.
Thanks, community, for you collaboration and consideration!