mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 03:21:33 +01:00
Move output handling into the render processor
This commit is contained in:
@@ -116,9 +116,6 @@ class Grav extends Container
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this['debugger'];
|
||||
|
||||
// process all processors (e.g. config, initialize, assets, ..., render)
|
||||
foreach ($this->processors as $processor) {
|
||||
$processor = $this[$processor];
|
||||
@@ -127,20 +124,10 @@ class Grav extends Container
|
||||
});
|
||||
}
|
||||
|
||||
$output = $this->output;
|
||||
|
||||
// Support for custom output providers like Slim Framework.
|
||||
if (!$output instanceof \Psr\Http\Message\ResponseInterface) {
|
||||
// Set the header type
|
||||
$this->header();
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
/** @var Debugger $debugger */
|
||||
$debugger = $this['debugger'];
|
||||
$debugger->render();
|
||||
|
||||
$this->fireEvent('onOutputRendered');
|
||||
|
||||
register_shutdown_function([$this, 'shutdown']);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,22 @@ class RenderProcessor extends ProcessorBase implements ProcessorInterface
|
||||
|
||||
public function process()
|
||||
{
|
||||
$this->container->output = $this->container['output'];
|
||||
$this->container->fireEvent('onOutputGenerated');
|
||||
$container = $this->container;
|
||||
$output = $container['output'];
|
||||
|
||||
if ($output instanceof \Psr\Http\Message\ResponseInterface) {
|
||||
// Support for custom output providers like Slim Framework.
|
||||
} else {
|
||||
// Use internal Grav output.
|
||||
$container->output = $output;
|
||||
$container->fireEvent('onOutputGenerated');
|
||||
|
||||
// Set the header type
|
||||
$container->header();
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
$container->fireEvent('onOutputRendered');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user