Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion en/appendices/4-1-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Routing
View
----

* ``Form/ContextInteface::primaryKey()`` was deprecated. Use ``getPrimaryKey()``
* ``Form/ContextInterface::primaryKey()`` was deprecated. Use ``getPrimaryKey()``
instead.

Behavior Changes
Expand Down Expand Up @@ -156,6 +156,7 @@ View

* Added ``TextHelper::slug()``. This method delegates to
``Cake\Utility\Text::slug()``.
* Added ``ViewBuilder::addHelper()`` as chainable wrapper method to add helpers.

Utility
-------
Expand Down
2 changes: 1 addition & 1 deletion en/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ theme that will be used when rendering the view, you can use the
properties of the view before it is created::

$this->viewBuilder()
->setHelpers(['MyCustom'])
->addHelper('MyCustom')
->setTheme('Modern')
->setClassName('Modern.Admin');

Expand Down
4 changes: 2 additions & 2 deletions en/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ helpers by prefixing the name of the plugin.

For example, say you wanted to use the ContactManager plugin's
ContactInfoHelper to output formatted contact information in
one of your views. In your controller, ``setHelpers()``
one of your views. In your controller, using ``addHelper()``
could look like this::

$this->viewBuilder()->setHelpers(['ContactManager.ContactInfo']);
$this->viewBuilder()->addHelper('ContactManager.ContactInfo');

.. note::
This dot separated class name is referred to as :term:`plugin syntax`.
Expand Down
2 changes: 1 addition & 1 deletion en/views/helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ You can also use your controller's ``beforeRender`` method to load helpers::
public function beforeRender(EventInterface $event)
{
parent::beforeRender($event);
$this->viewBuilder()->setHelpers(['MyHelper']);
$this->viewBuilder()->addHelper('MyHelper');
}
}

Expand Down