Kirby Twig Versions Save

Twig templating support for Kirby CMS 2. For Kirby 3, use https://github.com/amteich/kirby-twig

v2.0.0

7 years ago

Renamed options

All options in 2.0 were renamed from plugin.twig.something to twig.something, which is more usual for Kirby plugins. Note that in order to enable the plugin, the plugin.twig.enabled option was renamed to just twig, so that you can enable the plugin with:

c::set('twig', true);

Fewer limitations

The list of Kirby helper functions passed to Twig templates was revised to include almost all helper functions (instead of an arbitrary selection). There are also two options for passing more functions and even PHP classes to templates:

c::set('twig.env.functions', ['myFunction', 'str::endsWith']);
c::set('twig.env.classes', ['cookie', 'SomeClass']);

And classes can be used in Twig as {{ new('SomeClass', 'other', 'param').someMethod() }}.

While this is nice and sweet and can help in a pinch, note that most of the time you should use controllers instead, and pass your objects to the templates.

v1.3.0

8 years ago

Can now be installed more easily, without Composer.

v1.2.0

8 years ago

Somewhere along the way I skipped the 1.1 number, sorry.

v1.0.0

8 years ago