Skip to content

Commit

Permalink
feat: Add renderObjectTemplate() and renderTemplate() (which is c…
Browse files Browse the repository at this point in the history
…alled by `renderPageTemplate()`
  • Loading branch information
khalwat committed Jun 30, 2024
1 parent d31a773 commit c7d1e5a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/web/SandboxView.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ public function createTwig(): Environment
return $twig;
}

/**
* @inheritDoc
*/
public function renderObjectTemplate(string $template, mixed $object, array $variables = [], string $templateMode = self::TEMPLATE_MODE_SITE): string
{
$result = '';
try {
$result = parent::renderObjectTemplate($template, $object, $variables, $templateMode);
} catch (\Throwable $e) {
$this->sandboxErrorHandler->handleException($e);
}

return $result;
}

/**
* @inheritDoc
*/
Expand All @@ -68,4 +83,19 @@ public function renderString(string $template, array $variables = [], string $te

return $result;
}

/**
* @inheritDoc
*/
public function renderTemplate(string $template, array $variables = [], ?string $templateMode = null): string
{
$result = '';
try {
$result = parent::renderTemplate($template, $variables, $templateMode);
} catch (\Throwable $e) {
$this->sandboxErrorHandler->handleException($e);
}

return $result;
}
}

0 comments on commit c7d1e5a

Please sign in to comment.