我正在运行最新版本的Timber(0.22.5)。
有没有办法为Twig启用strict_variables
?
答案 0 :(得分:1)
想出来 - 把它贴在你的functions.php
文件中:
function theme_configure_twig($twig) {
$twig->enableStrictVariables();
return $twig;
}
add_filter('get_twig', 'theme_configure_twig');
请注意,在上文中,$twig
指的是Timber的Twig_Environment
实例。