Cms\Classes\ComponentPartial
Overview
The CMS component partial class. These objects are read-only.
Extends
Implements
- 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
- $implement - extensions for this class. (defined in October\Rain\Extension\Extendable)
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
- $extensionData - contains class reflection information, including behaviors. (defined in October\Rain\Extension\Extendable)
- $extendableStaticMethods - is a collection of static methods used by behaviors. (defined in October\Rain\Extension\Extendable)
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.
Inherited Public Methods
- __call() - calls an undefined local method. (defined in October\Rain\Extension\Extendable)
- __callStatic() - calls an undefined static method. (defined in October\Rain\Extension\Extendable)
- __get() - an undefined property. (defined in October\Rain\Extension\Extendable)
- __set() - an undefined property. (defined in October\Rain\Extension\Extendable)
- __sleep() - prepare the object for serialization. (defined in October\Rain\Extension\Extendable)
- __wakeup() - when a model is being unserialized, check if it needs to be booted. (defined in October\Rain\Extension\Extendable)
- addDynamicMethod() - programmatically adds a method to the extendable class. (defined in October\Rain\Extension\Extendable)
- addDynamicProperty() - programmatically adds a property to the extendable class. (defined in October\Rain\Extension\Extendable)
- asExtension() - is short hand for
getClassExtension()method, except takes the short. (defined in October\Rain\Extension\Extendable) - clearExtendedClasses() - (defined in October\Rain\Extension\Extendable)
- extend() - this class with a closure. (defined in October\Rain\Extension\Extendable)
- extendClassWith() - dynamically extends a class with a specified behavior. (defined in October\Rain\Extension\Extendable)
- extendableCall() - magic method for
__call(). (defined in October\Rain\Extension\Extendable) - extendableCallStatic() - magic method for
__callStatic(). (defined in October\Rain\Extension\Extendable) - extendableConstruct() - should be called as part of the constructor. (defined in October\Rain\Extension\Extendable)
- extendableDestruct() - should be called when serializing the object. (defined in October\Rain\Extension\Extendable)
- extendableExtendCallback() - is a helper method for
::extend()static method. (defined in October\Rain\Extension\Extendable) - extendableGet() - magic method for
__get(). (defined in October\Rain\Extension\Extendable) - extendableSet() - magic method for
__set(). (defined in October\Rain\Extension\Extendable) - getClassExtension() - returns a behavior object from an extendable class, example:. (defined in October\Rain\Extension\Extendable)
- getClassMethodAsReflector() - (defined in October\Rain\Extension\Extendable)
- getClassMethods() - gets a list of class methods, extension equivalent of get_class_methods(). (defined in October\Rain\Extension\Extendable)
- getDynamicProperties() - returns all dynamic properties and their values. (defined in October\Rain\Extension\Extendable)
- implementClassWith() - will implement an extension using non-interference and should. (defined in October\Rain\Extension\Extendable)
- isClassExtendedWith() - checks if extendable class is extended with a behavior object. (defined in October\Rain\Extension\Extendable)
- isClassInstanceOf() - checks if the class implements the supplied interface methods. (defined in October\Rain\Extension\Extendable)
- methodExists() - checks if a method exists, extension equivalent of method_exists(). (defined in October\Rain\Extension\Extendable)
- propertyExists() - checks if a property exists, extension equivalent of
property_exists(). (defined in October\Rain\Extension\Extendable)
Protected Methods
protected validateFileName()
protected validateFileName(string $fileName): string
validateFileName checks the supplied file name for validity.
Show inherited protected methods
Inherited Protected Methods
- extendableIsAccessible() - checks if a property is accessible, property equivalent. (defined in October\Rain\Extension\Extendable)
- extensionExtractImplements() - will return classes to implement. (defined in October\Rain\Extension\Extendable)
- extensionExtractMethods() - extracts the available methods from a behavior and adds it. (defined in October\Rain\Extension\Extendable)
- getExtendableMethodFromDynamicMethods() - (defined in October\Rain\Extension\Extendable)
- getExtendableMethodFromExtensions() - (defined in October\Rain\Extension\Extendable)