Skip to content

Commit d7838bc

Browse files
authored
Merge pull request #7975 from cakephp/text-insert
Add info about Text::insert() change.
2 parents 4983c7a + f9cdf79 commit d7838bc

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

en/appendices/6-0-migration-guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ Behavior Changes
1616
``JsonType`` by default.
1717
- ``Cake\View\Widget\FileWidget`` was removed as it was redundant. The standard
1818
input widget will be used for file inputs in 6.x.
19+
20+
Breaking Changes
21+
================
22+
- The default placeholder format for ``Text::insert()`` has been changed.
23+
They now use ``{foo}`` instead of ``:foo``. You can get the old
24+
behavior by using the ``before`` and ``after`` keys of ``$options``.

en/appendices/migration-guides.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ each version and the migration path between 5.x minor releases.
1111
./5-0-migration-guide
1212
./5-1-migration-guide
1313
./5-2-migration-guide
14+
./6-0-migration-guide
1415
./phpunit10

en/core-libraries/text.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,18 @@ The insert method is used to create string templates and to allow for key/value
129129
replacements::
130130

131131
Text::insert(
132-
'My name is :name and I am :age years old.',
132+
'My name is {name} and I am {age} years old.',
133133
['name' => 'Bob', 'age' => '65']
134134
);
135135
// Returns: "My name is Bob and I am 65 years old."
136136

137137
.. php:staticmethod:: cleanInsert($string, $options = [])
138138
139-
Cleans up a ``Text::insert`` formatted string with given ``$options`` depending
139+
Cleans up a ``Text::insert()`` formatted string with given ``$options`` depending
140140
on the 'clean' key in ``$options``. The default method used is text but html is
141141
also available. The goal of this function is to replace all whitespace and
142142
unneeded markup around placeholders that did not get replaced by
143-
``Text::insert``.
143+
``Text::insert()``.
144144

145145
You can use the following options in the options array::
146146

0 commit comments

Comments
 (0)