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.
View source (opens new window)
# Protected Properties
Property | Description |
---|---|
view | craft\web\View, null (opens new window) |
# view
- Type
- craft\web\View, null (opens new window)
- Default value
null
View source (opens new window)
# 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
View source (opens new window)
Arguments
$view
(craft\web\View)
# exists()
View source (opens new window)
Arguments
$name
# getCacheKey()
Gets the cache key to use for the cache for a given template.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The name of the template to load
Returns
string (opens new window) – The cache key (the path to the template)
Throws
- craft\web\twig\TemplateLoaderException
if the template doesn’t exist
# getSourceContext()
View source (opens new window)
Arguments
$name
# isFresh()
Returns whether the cached template is still up to date with the latest template.
View source (opens new window)
Arguments
$name
(string (opens new window)) – The template name$time
(integer (opens new window)) – The last modification time of the cached template
Returns
Throws
- craft\web\twig\TemplateLoaderException
if the template doesn’t exist