Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Documentation: twig.function.* option #17

Closed
fvsch opened this issue Jan 16, 2017 · 0 comments
Closed

Documentation: twig.function.* option #17

fvsch opened this issue Jan 16, 2017 · 0 comments
Labels

Comments

@fvsch
Copy link
Owner

fvsch commented Jan 16, 2017

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.

This feature enables plugins to register Twig functions and namespaces:

c::set([
  'twig.function.doSomething' => 'MyPlugin::doSomething',
  'twig.namespace.myplugin'   => __DIR__ . '/templates'
]);
@fvsch fvsch added the roadmap label Jan 17, 2017
@fvsch fvsch closed this as completed Jan 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant