Hi all,
My question is about Hierarchical Rendering and View rendering Events.
I'm rendering a hierarchy of Main View -> Controller View -> Action View and I'm attaching View event listener using the following code:
$eventsManager->attach('view', function($event, $view) {
if ('afterRenderView' == $event->getType()) {
// Append length of rendered content.
$content = $view->getContent();
$content .= PHP_EOL . '/* Content length: ' . strlen($content) . 'b */' . PHP_EOL;
$view->setContent($content);
}
});
I know that I can set rendering levels using LEVELACTION* set of constants (values of 1 through 5).
What I'm trying to do there is append the length of all rendered views. But the problem is, I need to do it only when I receive "afterRenderView" on "Controller View" level. I cannot attach to "afterRender" event, since by that time, the entire hierarchy has been rendered, and I only want to inject length summary after "Controller View" is done rendering (please don't ask why).
So, what I need in $view is a method like getCurrentLevel() that would return current LEVELACTION*.
Can this be done in some other way? If not, how can I submit a modest request for this feature.
Thanks, Temuri