Skip to content

Commit 63f00f2

Browse files
committed
Add info about Text::insert() change.
Refs cakephp/cakephp#18117
1 parent 4983c7a commit 63f00f2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

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 are now of the form ``{foo}`` instead of ``:foo``. You can get the old
24+
behavior by using the ``before`` and ``after`` keys of ``$options``.

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)