0

I client has recently been acquired by a new Group and has requested that I do a search and replace for their name e.g. "Foo Group" and replace this with "New Group". There will be multiple instances of this e.g. "Foo Housing Trust Group" and "Foo Housing Trust".

I can see in a previous post How to fix millions of alt text that are missing on body content that I can use the Search and Replace Scanner module but would this be the best way to do this rather than a DB Query?

Thank you for any help you can provide. Pete.

  • This was easy to do in 7 with a mysql find and replace, not so sure about 8. – Kevin Mar 22 '18 at 13:34
  • If you're okay with a stored procedure (it sounds like this only has to be ran once?) - this works in Drupal 8. I used this method myself to 'fix' bad links on a D8 site body content. It looks in any *_value table (common field table for text) and does a find and replace. kevinquillen.com/drupal/2017/07/13/… - be careful though, you'll definitely want to try and test it locally for your use case first. – Kevin Mar 22 '18 at 13:51
0

A possible alternative to achieve what you're trying to do, is to use a combination of these (commonly used) modules: Rules, Views and VBO.

With these modules in place, you could implement (for each of the fields that your question is related to) a variation of the solution described in my answer to "How to bulk update select list fields?", i.e.:

  • Create a Rules Component with a Rules Condition to checks if the field contains the string you're interested in (probably using a "text comparison" with a "regular expression" to find all variations).
  • Create a VBO enabled view of all nodes to be checked, whereas you'll use the Rules Component as your custom VBO action.

Repeat the above for each field (simply by adapting your Rules Component for each of these fields).

PS: I'm assuming this question is above D7 ...

Done ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.