Documentation

Loader extends Loader
in package
implements LoaderInterface

This class implements a Twig template loader for the CMS.

Tags
author

Alexey Bobkov, Samuel Georges

Interfaces, Classes and Traits

LoaderInterface
Interface all loaders must implement.

Table of Contents

$cache  : array<string|int, mixed>
$extension  : string
$fallbackCache  : array<string|int, mixed>
$obj  : CmsCompoundObject
exists()  : bool
Checks that the template exists.
getCacheKey()  : string
Returns the Twig cache key.
getFilename()  : string
Returns the file name of the loaded template.
getSourceContext()  : Source
Returns the Twig content string.
isFresh()  : bool
Determines if the content is fresh.
setObject()  : void
Sets a CMS object to load the template from.
findFallbackObject()  : Partial|bool
Looks up a fallback CMS partial object.
findTemplate()  : string
Gets the path of a view file
validateCmsObject()  : bool
Internal method that checks if the template name matches the loaded object, with fallback support to partials.

Properties

$cache

protected array<string|int, mixed> $cache = []

Cache

$extension

protected string $extension = 'htm'

Expected file extension

$fallbackCache

protected array<string|int, mixed> $fallbackCache = []

Cache

Methods

exists()

Checks that the template exists.

public exists(string $name) : bool
Parameters
$name : string

The template name

Return values
bool

getCacheKey()

Returns the Twig cache key.

public getCacheKey(string $name) : string
Parameters
$name : string

The template name

Return values
string

getFilename()

Returns the file name of the loaded template.

public getFilename(string $name) : string
Parameters
$name : string

The template name

Return values
string

getSourceContext()

Returns the Twig content string.

public getSourceContext(string $name) : Source

This step is cached internally by Twig.

Parameters
$name : string

The template name

Return values
Source

isFresh()

Determines if the content is fresh.

public isFresh(string $name, mixed $time) : bool
Parameters
$name : string

The template name

$time : mixed

The time to check against the template

Return values
bool

setObject()

Sets a CMS object to load the template from.

public setObject(CmsObject $obj) : void
Parameters
$obj : CmsObject

Specifies the CMS object.

Return values
void

findFallbackObject()

Looks up a fallback CMS partial object.

protected findFallbackObject(string $name) : Partial|bool
Parameters
$name : string

The filename to attempt to load a fallback CMS partial for

Return values
Partial|bool

Returns false if a CMS partial can't be found

findTemplate()

Gets the path of a view file

protected findTemplate(string $name) : string
Parameters
$name : string
Return values
string

validateCmsObject()

Internal method that checks if the template name matches the loaded object, with fallback support to partials.

protected validateCmsObject(string $name) : bool
Parameters
$name : string

The template name to validate

Return values
bool

Search results