Problem/Motivation

`dom_str_replace` currently only accepts a single search/replacement pattern. The underlying replacement functions i.e. `str_replace()` and `preg_replace()` accepts both a single pattern and an array of patterns. It would be great if we can utilize their untapped abilities.

Steps to reproduce

N/A

Proposed resolution

Alter relevant type declarations in `DomStrReplace::doReplace()`, `DomStrReplace::getSearch()`, and `DomStrReplace::getReplace()` to accept and return both string and array types.

Remaining tasks

Raise a pull request.

User interface changes

N/A

API changes

The `search` and `replace` keys now accept both a single value as well as a Yaml list.

Data model changes

N/A

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

progga created an issue. See original summary.

heddn’s picture

Status: Active » Needs work
Issue tags: +Needs tests

Posted feedback on the MR.

progga’s picture

Status: Needs work » Needs review

  • heddn committed 227b3b4c on 6.0.x authored by progga
    feat: #3569979 Feature: Multiple search/replacement patterns for `...
heddn’s picture

Status: Needs review » Fixed

Thanks for this new feature.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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