Cms\Classes\ComponentPartial

Source: ~/modules/cms/classes/ComponentPartial.php

Extends:

Implements:

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

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 2, 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 void __construct(Cms\Classes\ComponentBase $component)

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

Parameters

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

Returns true if the specific component contains a matching partial.

Parameters
  • Cms\Classes\ComponentBase $component - Specifies a component the file belongs to.
  • string $fileName - Specifies the file name to check.

public mixed|static find(string $fileName)

Find a single template by its file name.

Parameters
  • string $fileName

public string getBaseFileName()

Returns the file name without the extension.

public string getContent()

Returns the file content.

public string getDefaultExtension()

Returns the default extension used by this template.

public string getFileName()

Returns the file name.

public string getFilePath(string $fileName=NULL)

Returns the absolute file path.

Parameters
  • string $fileName - Specifies the file name to return the path to.

public string getTwigCacheKey()

Returns the key used by the Twig cache.

public string getTwigContent()

Returns the Twig content string.

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

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

Parameters
  • Cms\Classes\ComponentBase $component - Specifies the component the object belongs to.
  • string $fileName - Specifies the file name, with the extension. The file name can contain only alphanumeric symbols, dashes and dots.

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

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

Parameters

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

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.

Parameters

Show inherited public methods

Inherited public methods

Protected methods

protected string validateFileName(string $fileName)

Checks the supplied file name for validity.

Parameters
  • string $fileName

Show inherited protected methods

Inherited protected methods

  • protected boolean extendableIsAccessible(mixed $class, string $propertyName) - defined in October\Rain\Extension\Extendable. Checks if a property is accessible, property equivalent of is_callabe().
  • protected void extensionExtractMethods(string $extensionName, object $extensionObject) - defined in October\Rain\Extension\Extendable. Extracts the available methods from a behavior and adds it to the.