Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion installation/src/Application/InstallationApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function getTemplate($params = false)
$template->template = 'template';
$template->params = new Registry;
$template->inheritable = 0;
$template->parent = null;
$template->parent = '';

return $template;
}
Expand Down
11 changes: 11 additions & 0 deletions libraries/src/Application/ApiApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ protected function respond($options = array())
public function getTemplate($params = false)
{
// The API application should not need to use a template
if ($params)
{
$template = new \stdClass;
$template->template = 'system';
$template->params = new Registry;
$template->inheritable = 0;
$template->parent = '';

return $template;
}

return 'system';
}

Expand Down
7 changes: 4 additions & 3 deletions libraries/src/Application/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ protected function render()
{
// Setup the document options.
$options = array(
'template' => $this->get('theme'),
'file' => $this->get('themeFile', 'index.php'),
'params' => $this->get('themeParams'),
'template' => $this->get('theme'),
'file' => $this->get('themeFile', 'index.php'),
'params' => $this->get('themeParams'),
'templateInherits' => $this->get('themeInherits'),
);

if ($this->get('themes.base'))
Expand Down
21 changes: 14 additions & 7 deletions libraries/src/Error/Renderer/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ public function render(\Throwable $error): string
$app = Factory::getApplication();

// Get the current template from the application
$template = $app->getTemplate();
$template = $app->getTemplate(true);

// 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());
$wa = $this->getDocument()->getWebAssetManager()->getRegistry();

$wa->addTemplateRegistryFile($template->template, $app->getClientId());

if (!empty($template->parent))
{
$wa->addTemplateRegistryFile($template->parent, $app->getClientId());
}

if (ob_get_contents())
{
Expand All @@ -63,10 +69,11 @@ public function render(\Throwable $error): string
return $this->getDocument()->render(
false,
[
'template' => $template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG,
'csp_nonce' => $app->get('csp_nonce'),
'template' => $template->template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG,
'csp_nonce' => $app->get('csp_nonce'),
'templateInherits' => $template->parent
]
);
}
Expand Down