Documentation

Loader
in package
implements LoaderInterface

This class implements a Twig template loader for the core system and backend.

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
exists()  : bool
Check if we have the source code of a template, given its name.
getCacheKey()  : string
Gets the cache key to use for the cache for a given template name.
getFilename()  : mixed
getSourceContext()  : Source
Returns the source context for a given template logical name.
isFresh()  : bool
Returns true if the template is still fresh.
findTemplate()  : string
Gets the path of a view file

Properties

$cache

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

Cache

$extension

protected string $extension = 'htm'

Expected file extension

Methods

exists()

Check if we have the source code of a template, given its name.

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

The name of the template to check if we can load

Return values
bool

If the template source code is handled by this loader or not

getCacheKey()

Gets the cache key to use for the cache for a given template name.

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

The name of the template to load

Return values
string

The cache key

getFilename()

public getFilename(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

getSourceContext()

Returns the source context for a given template logical name.

public getSourceContext(mixed $name) : Source
Parameters
$name : mixed

The template logical name

Return values
Source

isFresh()

Returns true if the template is still fresh.

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

The template name

$time : mixed

Timestamp of the last modification time of the cached template

Return values
bool

true if the template is fresh, false otherwise

findTemplate()

Gets the path of a view file

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

Search results