Problem/Motivation

Currently dom_remove just removes tags specified by the xpath selector.

Proposed resolution

Add the ability to configure the plugin to remove an attribute on tags specified by the xpath selector.

The default functionality of the plugin remains the same so that no changes need to be made to existing migrations and it continues to work as before.

For example,

  process:
    bar:
      -
        plugin: dom
        method: import
        source: text_field
      -
        plugin: dom_remove
        mode: attribute
        selector: //*[@style]
        attribute: style
      -
        plugin: dom
        method: export

will remove all style attributes from all tags in the process pipeline.

This is replicated from drupal spoons: https://gitlab.com/drupalspoons/migrate_plus/-/merge_requests/9

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

RichardGaunt created an issue. See original summary.

richardgaunt’s picture

Issue tags: +Needs review
Parent issue: » #2958642: DOM manipulation on process plugins
richardgaunt’s picture

Issue summary: View changes
star-szr’s picture

Status: Active » Needs review

Not sure how this issue queue works exactly but setting to needs review and left some nitpicks on the merge request: https://gitlab.com/drupalspoons/migrate_plus/-/merge_requests/25

Otherwise, this looks good and works well. Thank you for sharing this!

Matroskeen made their first commit to this issue’s fork.

  • Matroskeen committed c31704c on 8.x-5.x
    Issue #3225457 by RichardGaunt: Add additional functionality to `...

  • Matroskeen committed 0809693 on 6.0.x
    Issue #3225457 by RichardGaunt: Add additional functionality to `...
matroskeen’s picture

Status: Needs review » Fixed
Issue tags: -Needs review

I applied some minor changes to documentation, and tests, and reverted the $walking_dead, I just like it! :)

It was merged into 8.x-5.x and cherry-picked into 6.0.x.
Thank you!

Status: Fixed » Closed (fixed)

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