Closed fvsch closed 7 years ago
Document the new way to expose a function in the templating environment:
c::set('twig.function.myFunction', 'myFunctionsFullName'); c::set('twig.function.myFunction', function(){ /* return something */ });
And similarly for filters.
The old way, c::set('twig.env.functions', ['myFunctionsFullName']);, still works.
c::set('twig.env.functions', ['myFunctionsFullName']);
This feature enables plugins to register Twig functions and namespaces:
c::set([ 'twig.function.doSomething' => 'MyPlugin::doSomething', 'twig.namespace.myplugin' => __DIR__ . '/templates' ]);
Document the new way to expose a function in the templating environment:
And similarly for filters.
The old way,
c::set('twig.env.functions', ['myFunctionsFullName']);
, still works.This feature enables plugins to register Twig functions and namespaces: