Cms\Twig\Loader

Source: ~/modules/cms/twig/Loader.php

Extends:

Implements:

  • Twig_LoaderInterface

This class implements a Twig template loader for the CMS.

Protected properties

protected Cms\Classes\CmsCompoundObject $obj

A CMS object to load the template from.

protected array $fallbackCache

Cache

Show inherited protected properties

Inherited protected properties

Public methods

public void exists($name)

Checks that the template exists.

Parameters
  • $name

public void getCacheKey($name)

Returns the Twig cache key.

Parameters
  • $name

public void getFilename($name)

Returns the file name of the loaded template.

Parameters
  • $name

public void getSourceContext($name)

Returns the Twig content string. This step is cached internally by Twig.

Parameters
  • $name

public void isFresh($name, $time)

Determines if the content is fresh.

Parameters
  • $name
  • $time

public void setObject(Cms\Contracts\CmsObject $obj)

Sets a CMS object to load the template from.

Parameters

Protected methods

protected Cms\Classes\Partial findFallbackObject($name)

Looks up a fallback CMS partial object.

Parameters
  • $name

protected bool validateCmsObject($name)

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

Parameters
  • $name

Show inherited protected methods

Inherited protected methods

  • protected string findTemplate(string $name) - defined in System\Twig\Loader. Gets the path of a view file.