#5906: AfterRender helper method called when rendering a Layout
-----------------------------------+----------------------------------------
Reporter: bakachu | Owner:
Type: Bug | Status: reopened
Priority: Medium | Milestone: 1.2.x.x
Component: View | Version: RC4
Severity: Normal | Resolution:
Keywords: afterRender layout | Php_version: n/a
Cake_version: 1.2.0.7945 RC4 |
-----------------------------------+----------------------------------------
Changes (by bakachu):
* status: closed => reopened
* resolution: needmoreinfo =>
Comment:
Hi,
In the old code (The 7885 you linked to), the following line prevents the
afterRender() method being called when _render() is processing a Layout :
if (!empty($loadedHelpers)) {
}
The $loadHelpers variable is only set if the below conditions are met
(Line 644 in view.php:7885):
if ($this->helpers != false && $loadHelpers === true) {
}
The above conditions will fail when rendering a layout, causing
$loadedHelpers to be empty, however post SVN 7885 the afterRender method
is called anyway.
Incidently, the beforeRender() method is correctly not called when
rendering a Layout, as it is contained in the appropiate check above, so
its just the afterRender that's method firing.
A quick fix in the latest code is to wrap the
this->_triggerHelpers('afterRender') call as follows :
if (!empty($loadedHelpers)) {
this->_triggerHelpers('afterRender');
}
I appreciate this is awkard to describe without tests, I will try writing
a test next week for this (never done one before!)
Thanks very much, and have a nice holiday season
--
Ticket URL: <https://trac.cakephp.org/ticket/5906#comment:2>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---