Skip to content

Add additional functionality to `dom_remove` process plugin.

Background

Currently dom_remove just removes tags specified by the xpath selector.

This MR adds 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.

What has changed

  1. Added additional configuration and functionality, updated comments / examples in the DomRemove plugin class
  2. Added unit tests to ensure the above functionality is working as expected.

Merge request reports