The CMS component partial class. These objects are read-only.

  • Cms\Contracts\CmsObject

Public Properties

public string $fileName

The component partial file name.

public string $mtime

Last modified time.

public string $content

Partial content.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected Cms\Classes\ComponentBase $component

A reference to the CMS component containing the object.

protected int $maxNesting

The maximum allowed path nesting level. The default value is 5, meaning that files can only exist in the root directory, or in a subdirectory. Set to null if any level is allowed.

protected array $allowedExtensions

Allowable file extensions.

protected string $defaultExtension

Default file extension.

Show inherited protected properties

Inherited Protected Properties

Public Methods

public __construct()

public __construct(Cms\Classes\ComponentBase $component): void

__construct an instance of the object and associates it with a CMS component.

public static all()

public static all($component): array 

all loads all partials for a given component

public static check()

public static check(
    Cms\Classes\ComponentBase $component,
    string $fileName
): bool 

check returns true if the specific component contains a matching partial.

public find()

public find(string $fileName): mixed|static 

find a single template by its file name.

public getBaseFileName()

public getBaseFileName(): string 

getBaseFileName returns the file name without the extension.

public getContent()

public getContent(): string 

getContent returns the file content.

public getDefaultExtension()

public getDefaultExtension(): string 

getDefaultExtension returns the default extension used by this template.

public getFileName()

public getFileName(): string 

getFileName returns the file name.

public getFilePath()

public getFilePath(string $fileName = null): string 

getFilePath returns the absolute file path.

public getTwigCacheKey()

public getTwigCacheKey(): string 

getTwigCacheKey returns the key used by the Twig cache.

public getTwigContent()

public getTwigContent(): string 

getTwigContent returns the Twig content string.

public static load()

public static load(
    Cms\Classes\ComponentBase $component,
    string $fileName
): mixed 

load the object from a file. This method is used in the CMS back-end. It doesn't use any caching.

public static loadCached()

public static loadCached(
    Cms\Classes\ComponentBase $component,
    string $fileName
): mixed 

loadCached since there is not much point caching a component partial, so this behavior reverts to a regular load call.

public static loadOverrideCached()

public static loadOverrideCached(
    Cms\Classes\Theme $theme,
    Cms\Classes\ComponentBase $component,
    string $fileName
): mixed 

loadOverrideCached checks if a partial override exists in the supplied theme and returns it. Since the beginning of time, October inconsistently checked for overrides using the component alias exactly, resulting in a folder with uppercase characters, subsequently this method checks for both variants.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected validateFileName()

protected validateFileName(string $fileName): string 

validateFileName checks the supplied file name for validity.

Show inherited protected methods

Inherited Protected Methods