TemplateLoader ​
- Type
- Class
- Namespace
- craft\web\twig
- Inherits
- craft\web\twig\TemplateLoader
- Implements
Twig\Loader\LoaderInterface
- Since
- 3.0.0
Loads Craft templates into Twig.
Protected Properties ​
Property | Description |
---|---|
view | craft\web\View, null |
view
​
- Type
- craft\web\View, null
- Default value
null
Public Methods ​
Method | Description |
---|---|
__construct() | Constructor |
exists() | |
getCacheKey() | Gets the cache key to use for the cache for a given template. |
getSourceContext() | |
isFresh() | Returns whether the cached template is still up to date with the latest template. |
__construct()
​
Constructor
Arguments ​
$view
(craft\web\View)
exists()
​
Arguments ​
$name
getCacheKey()
​
Gets the cache key to use for the cache for a given template.
Arguments ​
$name
(string) – The name of the template to load
Returns ​
string – The cache key (the path to the template)
Throws ​
- craft\web\twig\TemplateLoaderException
if the template doesn’t exist
getSourceContext()
​
Arguments ​
$name
isFresh()
​
Returns whether the cached template is still up to date with the latest template.
Arguments ​
$name
(string) – The template name$time
(integer) – The last modification time of the cached template
Returns ​
Throws ​
- craft\web\twig\TemplateLoaderException
if the template doesn’t exist