TemplateLoader

Type
Class
Namespace
craft\web\twig
Inherits
craft\web\twig\TemplateLoader
Implements
Twig_ExistsLoaderInterface, Twig_LoaderInterface

View source

Protected Properties

PropertyDescription
$viewcraft\web\View, null

$view

Signature

protected craft\web\View, null $view = null

Public Methods

MethodDescription
__construct()Constructor
exists()Check if we have the source code of a template, given its name.
getCacheKey()Gets the cache key to use for the cache for a given template.
getSourceContext()Returns the source context for a given template logical name.
isFresh()Returns whether the cached template is still up-to-date with the latest template.

__construct()

Constructor

View source

Arguments

Signature

public void __construct ( craft\web\View $view )

exists()

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

View source

Arguments

  • $name (string) – The name of the template to check if we can load

Returns

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

Signature

public boolean exists ( $name )

getCacheKey()

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

View source

Arguments

  • $name (string) – The name of the template to load

Returns

string – The cache key (the path to the template)

Throws

Signature

public string getCacheKey ( $name )

getSourceContext()

Returns the source context for a given template logical name.

View source

Arguments

  • $name (string) – The template logical name

Returns

Twig_Source

Throws

Signature

public Twig_Source getSourceContext ( $name )

isFresh()

Returns whether the cached template is still up-to-date with the latest template.

View source

Arguments

  • $name (string) – The template name
  • $time (integer) – The last modification time of the cached template

Returns

boolean

Throws

Signature

public boolean isFresh ( $name, $time )