Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info about Text::insert() change. #7975

Merged
merged 3 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions en/appendices/6-0-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ Behavior Changes
``JsonType`` by default.
- ``Cake\View\Widget\FileWidget`` was removed as it was redundant. The standard
input widget will be used for file inputs in 6.x.

Breaking Changes
================
- The default placeholder format for ``Text::insert()`` has been changed.
They now use ``{foo}`` instead of ``:foo``. You can get the old
behavior by using the ``before`` and ``after`` keys of ``$options``.
6 changes: 3 additions & 3 deletions en/core-libraries/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ The insert method is used to create string templates and to allow for key/value
replacements::

Text::insert(
'My name is :name and I am :age years old.',
'My name is {name} and I am {age} years old.',
['name' => 'Bob', 'age' => '65']
);
// Returns: "My name is Bob and I am 65 years old."

.. php:staticmethod:: cleanInsert($string, $options = [])

Cleans up a ``Text::insert`` formatted string with given ``$options`` depending
Cleans up a ``Text::insert()`` formatted string with given ``$options`` depending
on the 'clean' key in ``$options``. The default method used is text but html is
also available. The goal of this function is to replace all whitespace and
unneeded markup around placeholders that did not get replaced by
``Text::insert``.
``Text::insert()``.

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

Expand Down
Loading