Cms\Twig\Loader

Overview

Loader implements a Twig template loader for the CMS.

Extends
Implements
  • Twig\Loader\LoaderInterface

Protected Properties

protected Cms\Classes\CmsCompoundObject $obj

obj is the CMS object to load the template from.

protected array $fallbackCache

fallbackCache for fallback objects.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public exists()

public exists($name): void

exists checks that the template exists.

public getCacheKey()

public getCacheKey($name): string 

getCacheKey returns the Twig cache key.

public getFilename()

public getFilename($name): void

getFilename returns the file name of the loaded template.

public getSourceContext()

public getSourceContext($name): Twig\Source 

getSourceContext returns the Twig content string. This step is cached internally by Twig.

public isFresh()

public isFresh($name, $time): bool 

isFresh determines if the content is fresh.

public setObject()

public setObject($obj): void

setObject sets a CMS object to load the template from.

Show inherited public methods

Inherited Public Methods

  • addCacheItem() - addCache adds a specific item to cache. (defined in System\Twig\Loader)

Protected Methods

protected findFallbackObject()

protected findFallbackObject($name): Cms\Classes\Partial 

findFallbackObject looks up a fallback CMS partial object.

protected validateCmsObject()

protected validateCmsObject($name): bool 

validateCmsObject is an internal method that checks if the template name matches the loaded object, with fallback support to partials.

Show inherited protected methods

Inherited Protected Methods