comparison modules/contrib/migrate_plus/src/Plugin/migrate/process/StrReplace.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
12 * 12 *
13 * @MigrateProcessPlugin( 13 * @MigrateProcessPlugin(
14 * id = "str_replace" 14 * id = "str_replace"
15 * ) 15 * )
16 * 16 *
17 * To do a simple hardcoded string replace use the following: 17 * @codingStandardsIgnoreStart
18 * 18 *
19 * To do a simple hardcoded string replace, use the following:
19 * @code 20 * @code
20 * field_text: 21 * field_text:
21 * plugin: str_replace 22 * plugin: str_replace
22 * source: text 23 * source: text
23 * search: foo 24 * search: foo
24 * replace: bar 25 * replace: bar
25 * @endcode 26 * @endcode
26 *
27 * If the value of text is "vero eos et accusam et justo vero" in source, foo is 27 * If the value of text is "vero eos et accusam et justo vero" in source, foo is
28 * "et" in search and bar is "that" in replace, field_text will be "vero eos 28 * "et" in search and bar is "that" in replace, field_text will be "vero eos
29 * that accusam that justo vero". 29 * that accusam that justo vero".
30 * 30 *
31 * Case insensitive searches can be achieved using the following: 31 * Case insensitive searches can be achieved using the following:
35 * case_insensitive: true 35 * case_insensitive: true
36 * source: text 36 * source: text
37 * search: foo 37 * search: foo
38 * replace: bar 38 * replace: bar
39 * @endcode 39 * @endcode
40 *
41 * If the value of text is "VERO eos et accusam et justo vero" in source, foo is 40 * If the value of text is "VERO eos et accusam et justo vero" in source, foo is
42 * "vero" in search and bar is "that" in replace, field_text will be "that eos 41 * "vero" in search and bar is "that" in replace, field_text will be "that eos
43 * et accusam et justo that". 42 * et accusam et justo that".
44 * 43 *
45 * Also regular expressions can be matched using: 44 * Also regular expressions can be matched using:
49 * regex: true 48 * regex: true
50 * source: text 49 * source: text
51 * search: foo 50 * search: foo
52 * replace: bar 51 * replace: bar
53 * @endcode 52 * @endcode
54 *
55 * If the value of text is "vero eos et 123 accusam et justo 123 duo" in source, 53 * If the value of text is "vero eos et 123 accusam et justo 123 duo" in source,
56 * foo is "/[0-9]{3}/" in search and bar is "the" in replace, field_text will be 54 * foo is "/[0-9]{3}/" in search and bar is "the" in replace, field_text will be
57 * "vero eos et the accusam et justo the duo". 55 * "vero eos et the accusam et justo the duo".
58 * 56 *
59 * All the rules for 57 * All the rules for
66 * plugin: str_replace 64 * plugin: str_replace
67 * source: text 65 * source: text
68 * search: ["AT", "CH", "DK"] 66 * search: ["AT", "CH", "DK"]
69 * replace: ["Austria", "Switzerland", "Denmark"] 67 * replace: ["Austria", "Switzerland", "Denmark"]
70 * @endcode 68 * @endcode
69 *
70 * @codingStandardsIgnoreEnd
71 */ 71 */
72 class StrReplace extends ProcessPluginBase { 72 class StrReplace extends ProcessPluginBase {
73 73
74 /** 74 /**
75 * Flag indicating whether there are multiple values. 75 * Flag indicating whether there are multiple values.