Loader
This class implements a Twig template loader for the CMS.
class Cms\Twig\Loader
extends System\Twig\Loader
implements
Twig\Loader\LoaderInterface
Extends
Class | Description |
---|---|
Loader
|
This class implements a Twig template loader for the core system and backend. |
Properties
protected
$fallbackCache
:
array
= []
Cache
protected $obj : Cms\Classes\CmsCompoundObject
A CMS object to load the template from.
inherited
public
static
$allowInclude
:
bool
= false
Allow any local file
inherited
protected
$cache
:
array
= []
Cache
Methods
public exists (string $name) : bool
Checks that the template exists.
Property | Type | Description |
---|---|---|
$name | string |
string
|
public getCacheKey (string $name) : string
Returns the Twig cache key.
Property | Type | Description |
---|---|---|
$name | string |
string
|
public getFilename (string $name) : string
Returns the file name of the loaded template.
Property | Type | Description |
---|---|---|
$name | string |
string
|
public getSourceContext (string $name) : Twig\Source
Returns the Twig content string.
This step is cached internally by Twig.
Property | Type | Description |
---|---|---|
$name | string |
string
|
public isFresh (string $name, integer $time) : bool
Determines if the content is fresh.
Property | Type | Description |
---|---|---|
$name | string |
string
The template name |
$time | integer |
integer
The time to check against the template |
public setObject (Cms\Contracts\CmsObject $obj) : void
Sets a CMS object to load the template from.
Property | Type | Description |
---|---|---|
$obj | Cms\Contracts\CmsObject |
Cms\Contracts\CmsObject
Specifies the CMS object. |
protected findFallbackObject (string $name) : Cms\Classes\Partial | bool
Looks up a fallback CMS partial object.
Property | Type | Description |
---|---|---|
$name | string |
string
The filename to attempt to load a fallback CMS partial for |
Returns false if a CMS partial can't be found
protected validateCmsObject (string $name) : bool
Internal method that checks if the template name matches the loaded object, with fallback support to partials.
Property | Type | Description |
---|---|---|
$name | string |
string
|
inherited protected findTemplate (string $name) : string
Gets the path of a view file.
Property | Type | Description |
---|---|---|
$name | string |
string
|