Closed (fixed)
Project:
Migrate Plus
Version:
8.x-5.x-dev
Component:
Plugins
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Apr 2018 at 04:23 UTC
Updated:
13 Aug 2019 at 12:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
marvil07 commentedOne more dom migrate process plugin!
Comment #3
benjifisherComment #4
fls-pcate commentedI was able to apply the patch(s) and replace entity ID based links in HTML body fields with relative ease. Thanks for working on this added feature.
Comment #5
benjifisherThe plugin in this patch extends the one added in #2958285: Allow replacing based on a xpath expression, so I am marking this issue postponed. If that issue is accepted in its current form, then we will also need to update this patch to be compatible with the new base class.
Comment #6
marvil07 commented#2958285: Allow replacing based on a xpath expression was accepted \o/, back to NW.
Comment #7
benjifisherI have updated the plugin to use the base class we added in #2958285: Allow replacing based on a xpath expression, and I added a test class.
I think we should have a single change record for all the DOM-related process plugins. We might also want to update the project page.
I have not done any manual testing, but the automated tests are passing locally.
On #3042539: Apply styles configured for CKEditor, I asked about the two different approaches to creating mock objects. I think the
getMock()one is deprecated, so here I continue to useprophesize()as I did on that issue.I see that there is now an 8.x-5.x branch, and that is the only one that can be used for automated tests, so I have updated the issue metadata to refer to that branch. I generated the patch by comparing to the 8.x-4.x branch, but the patch applies cleanly to either branch.
Comment #8
benjifisherI think the issue title is unclear.
While I am at it, I will update the issue description: after the previous comment, we do not have to list tests in the "Remaining tasks" section.
Comment #9
alisonThis is sooooooo cooooooooolllllllll............. I don't have a need for it at the moment, I just wanted to say, sooooooo coooooooooooollllll.
Question: If there's a single change record for all the DOM-related process plugins, would that mean they each have to wait to be rolled into the module til they're all done, or?
Comment #10
heddnReally great work here. Just a few small comments.
Nit: s/id/ID/
Naming... does
dom_migration_lookupstrike your fancy? I'm trying to think of something less wordy/long for the name of the plugin.Could we make no_stub a configurable option to this plugin with a default of TRUE?
Comment #11
benjifisher@alisonjo2786:
Thanks. It is also useful!
@heddn:
Thanks for the review!
no_stub: false, but that seems hard to do properly.Normally I use the
interdiffutility because there is more room for error when usinggit. In this case, the utility generated an interdiff with both files removed and then new ones added (because I renamed the files) so I usedgit.I still owe you a change record.
Comment #12
benjifisherI drafted a change record: Add process plugins for HTML processing using DOMDocument objects. It describes the process plugins added in this issue and the other children of #2958642: DOM manipulation on process plugins.
I am not sure what the next planned release is for Migrate Plus: 8.x-4.3 or 8.x-5.0.
It is out of scope for the current issue, but while writing the CR, I noticed an inconsistency. The
dom_migration_lookupplugin introduced in this issue and thedom_str_replaceplugin added in the 8.x-4.2 release useexpressionas the parameter for the XPath expression. Thedom_apply_stylesplugin from #3042539: Apply styles configured for CKEditor usesxpathfor the same thing.Should we make these consistent? Personally, I prefer
xpath. Since 8.x-4.2 already contains a plugin that usesexpression, we would have to keep that as an alias, but deprecate it. Alternatively, we could modify thedom_apply_stylesplugin to be consistent with the others. Since that is only in the dev release, I think we can change it without supporting the original syntax.Comment #13
alison@benjifisher Oh that's a great catch -- I agree about using
xpathfor the config key,expressionseems more generic (like, even in this specific context, you've got "regular expression" right there). But, good point that we'd have to keep "expression" at least as an alias... Is that a hassle, or no big deal, or?I strongly prefer
xpath, but, I'd rather have the consistency and settle forexpressionthan not have the consistency.(Happy to help implement, when there's a decision!)
Comment #14
heddn5.0 is the next planned release. 4.x has BC issues with 9.x and doesn't have any further planned development. See #3052510: Entity manager deprecation fixes. Since 5.x doesn't have a stable release yet, we could just make the fixes for xpath vs expression and mention in release notes / change record.
Leaving in NR to ponder these things. But otherwise, this is looking really good.
Comment #15
benjifisherWe discussed this in the #3067311: [meeting] Migrate Meeting 2019-07-11.
dom_str_replaceplugin).I prefer "xpath", since "expression" seems too generic in this context, and @alisonjo2786 (#13 on this issue) agrees.
Does anyone else want to vote on whether to call the parameter "expression" or "xpath"? (I will also solicit opinions on the #migration Slack channel.)
Comment #16
alisonDiscussed on #migration slack channel -- came to a decision to change config key name from "expression" to "xpath" -- for this new plugin (
dom_migration_lookup), and the plugin it extends (dom_str_replace).As such -- see attached!
I made an initial update to the Change record -- is there a typical way to highlight a change within the changes like this? I'll work on something, but if anyone has an example, pls feel free to update it again / change what I put / point me to an example / etc.
Comment #17
heddnNit: same line? Will fix on commit.
Comment #19
heddnThanks to everyones contributions here. I'll tag a release with this too.
Comment #20
idebr commentedI moved dom_migrate_lookup to the list of available process plugins provided by Migrate Plus on the documentation page: https://www.drupal.org/docs/8/api/migrate-api/migrate-process-plugins/li...
Comment #21
benjifisher@idebr: Thanks!