grav/system/src/Grav/Common/Processors/RenderProcessor.php
2017-05-17 15:29:21 -06:00

38 lines
964 B
PHP

<?php
/**
* @package Grav.Common.Processors
*
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Processors;
class RenderProcessor extends ProcessorBase implements ProcessorInterface
{
public $id = 'render';
public $title = 'Render';
public function process()
{
$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;
// remove any output
$container->output = '';
}
}
}