Mats Mikkel Rummelhoff
Mats Mikkel Rummelhoff

Reputation: 131

Enabling Twig strict variables with Timber

I'm running the latest version of Timber (0.22.5).

Is there a way that I can enable strict_variables for Twig?

Upvotes: 2

Views: 335

Answers (1)

Mats Mikkel Rummelhoff
Mats Mikkel Rummelhoff

Reputation: 131

Figured it out – stick this in your functions.php file:

function theme_configure_twig($twig) {
    $twig->enableStrictVariables();
    return $twig;
}
add_filter('get_twig', 'theme_configure_twig');

Note that in the above, $twig refers to Timber's instance of Twig_Environment.

Upvotes: 1

Related Questions