ViewSetup
Helper class to set up Twig for use in the network.
Registering a Twig directory
Twig uses a file loader system for registering templates. You can register your own "templates directory" if you want to use Twig templates in your theme or plugin. To do this you'll need to provide a path
to the templates and a namespace
.
You'll then be able to use your templates through your namespace
using a path relative to the provided path
when rendering with View
:
You can also use the namespace
to include
and extend
templates.
Extending Twig
Twig offers multiple ways to be extended, read more about them in their documentation.
ViewSetup
extends this way of extending Twig.
Globals
See Twig documentation here
Filters
See Twig documentation here
We instantiate a
\Twig\TwigFilter
class for you so you need to provide the data for that.
Functions
See Twig documentation here
We instantiate a
\Twig\TwigFunction
class for you so you need to provide the data for that.
Tests
See Twig documentation here
We instantiate a
\Twig\TwigTest
class for you so you need to provide the data for that.
Advanced Extension
We also offer support for the more advanced ways of extending Twig.
Tags
See Twig documentation here
Extensions
See Twig documentation here
RuntimeLoader
See Twig documentation here
Last updated
Was this helpful?