Prevent breakage when switching to PROD, with {{ dump }} in the templates

This commit is contained in:
Bob den Otter
2020-01-03 20:25:23 +01:00
parent e1adabc4d1
commit 9838fa2aec
2 changed files with 31 additions and 0 deletions
+2
View File
@@ -67,7 +67,9 @@ services:
- { name: knp_menu.menu_builder, method: createAdminMenu, alias: admin_menu } # The alias is what is used to retrieve the menu
Bolt\Menu\BackendMenuBuilderInterface: '@Bolt\Menu\BackendMenuBuilder'
Bolt\Menu\FrontendMenuBuilder: ~
Bolt\Menu\FrontendMenuBuilderInterface: '@Bolt\Menu\FrontendMenuBuilder'
# Needed for SetContent from bolt/core
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Bolt\Twig;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
/**
* Dump Twig extension.
*
* This is a (deliberately) empty extension. When the implementor switched a
* site from DEV to PROD, it shouldn't break if there's a lingering `{{ dump }}`
* left in the site. This Twig Extension acts as a fallback to prevent that.
*/
class DumpExtension extends AbstractExtension
{
public function getFunctions(): array
{
return [
new TwigFunction('dump', [$this, 'dump']),
];
}
public function dump(): void
{
}
}