- md5
- cd47bfbb6fcc71008ae25f387d986a64
- sha1
- 93648637629497f5ec5a3a687140925a26eca86d
- sha256
- 8b1ee585a48b8e41bcbee38e6c3ffcd04ead89dce3bae86104787fd4ecbf6f87
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\CMS\Error\Renderer;
\defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Error\AbstractRenderer;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
/**
* HTML error page renderer
*
* @since 4.0
* @todo Change this renderer to use JDocumentHtml instead of JDocumentError, the latter is only used for B/C at this time
*/
class HtmlRenderer extends AbstractRenderer
{
/**
* The format (type) of the error page
*
* @var string
* @since 4.0
*/
protected $type = 'error';
/**
* Render the error page for the given object
*
* @param \Throwable $error The error object to be rendered
*
* @return string
*
* @since 4.0
*/
public function render(\Throwable $error): string
{
$app = Factory::getApplication();
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$this->getDocument()->setError($error);
// Add registry file for the template asset
$this->getDocument()->getWebAssetManager()->getRegistry()
->addTemplateRegistryFile($template, $app->getClientId());
if (ob_get_contents())
{
ob_end_clean();
}
$this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode());
return $this->getDocument()->render(
false,
[
'template' => $template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG,
'csp_nonce' => $app->get('csp_nonce'),
]
);
}
}
The same content is in 3 releases, Joomla 4.0.0-beta to 4.0.0-beta3. See them all, or every version of this file.