Fixed bug causing a header warning.

By default, FuzeWorks\Layout doesn't redirect it's display output to FuzeWorks\Output. If this is desired behaviour the layoutDisplayEvent needs to be interrupted. This eventListener was not implemented, resulting in FuzeWorks\Layout::display output not being redirected.

This patch fixes that.
This commit is contained in:
Abel Hoogeveen 2019-11-06 00:19:33 +01:00
parent 0ba98f8130
commit 74cb630d80
No known key found for this signature in database
GPG Key ID: 96C2234920BF4292
1 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,7 @@
namespace FuzeWorks;
use FuzeWorks\Event\HaltExecutionEvent;
use FuzeWorks\Event\LayoutDisplayEvent;
use FuzeWorks\Event\LayoutLoadEvent;
use FuzeWorks\Event\RouterCallViewEvent;
use FuzeWorks\Event\RouterLoadViewAndControllerEvent;
@ -158,6 +159,15 @@ class WebComponent implements iComponent
return $event;
}, 'coreShutdownEvent', Priority::NORMAL);
// Intercept output of Layout and redirect it to Output
Events::addListener(function($event){
/** @var $event LayoutDisplayEvent */
/** @var Output $output */
$output = Factory::getInstance('output');
$output->appendOutput($event->contents);
$event->setCancelled(true);
}, 'layoutDisplayEvent', Priority::NORMAL);
// Add HTTP method prefix to requests to views
Events::addListener(function($event){
/** @var Input $input */