Cms\Classes\CmsCompoundObject

Overview

CmsCompoundObject base class for CMS objects that have multiple sections - pages, partials and layouts. The class implements functionality for the compound object file parsing. It also provides a way to access parameters defined in the INI settings section as the object properties.

Extends
Implements
  • Cms\Contracts\CmsObject
  • Stringable
  • JsonSerializable
  • Illuminate\Contracts\Support\Jsonable
  • Illuminate\Contracts\Support\Arrayable
  • ArrayAccess

Public Properties

public array $components

components defined in the template file

public array $settings

settings defined in the template file. Not to be confused with the attribute called settings. In this array, components are bumped to their own array inside the 'components' key.

public array $viewBag

viewBag contains the view bag properties. This property is used by the page editor internally.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected array $fillable

fillable attributes that are mass assignable.

protected array $passthru

passthru methods that should be returned from the collection of all objects.

protected bool $isCompoundObject

isCompoundObject for models that support code and settings sections.

protected static array|null $objectComponentPropertyMap

objectComponentPropertyMap cache for component properties.

protected mixed $viewBagCache

viewBagCache store for the getViewBag method.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __call()

public __call(string $method, array $parameters): mixed 

__call dynamically handles calls into the query instance.

public __get()

public __get($name): void

__get functionality for visible properties defined in the settings section or view bag array.

public __isset()

public __isset(string $key): bool 

__isset determines if an attribute exists on the object.

public __set()

public __set(string $key, mixed $value): void 

__set dynamically sets attributes on the model.

public afterFetch()

public afterFetch(): void

afterFetch event

public beforeSave()

public beforeSave(): void

beforeSave event

public static clearCache()

public static clearCache(Cms\Classes\Theme $theme): void 

clearCache clears the object cache.

public getComponent()

public getComponent(string $componentName): Cms\Classes\ComponentBase 

getComponent returns a component by its name. This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.

public getComponentProperties()

public getComponentProperties(string $componentName): array 

getComponentProperties returns component property names and values. This method implements caching and can be used in the run-time on the front-end.

public getTwigContent()

public getTwigContent(): string 

getTwigContent returns the Twig content string

public getTwigNodeTree()

public getTwigNodeTree(mixed $markup = false): Twig\Node\ModuleNode 

getTwigNodeTree returns Twig node tree generated from the object's markup. This method is used by the system internally and shouldn't participate in the front-end request processing.

public getViewBag()

public getViewBag(): Cms\Components\ViewBag 

getViewBag returns the configured view bag component. This method is used only in the back-end and for internal system needs when the standard way to access components is not an option.

public hasComponent()

public hasComponent(string $componentName): string|bool 

hasComponent checks if the object has a component with the specified name. Returns false or the full component name used on the page (it could include the alias).

public newCollection()

public newCollection($models = ]): [October\Rain\Halcyon\Collection 

newCollection creates a new Collection instance.

public runComponents()

public runComponents(): void

runComponents defined in the settings, this process halts if a component returns a value.

public toArray()

public toArray(): array 

toArray returns an array representation of the object

Show inherited public methods

Inherited Public Methods

Protected Methods

protected checkSafeMode()

protected checkSafeMode(): void 

checkSafeMode checks if safe mode is enabled by config, and the code attribute is modified and populated. If so an exception is thrown.

protected fillViewBagArray()

protected fillViewBagArray(): void 

fillViewBagArray copies view bag properties to the view bag array. This is required for the back-end editors.

protected static makeComponentPropertyCacheKey()

protected static makeComponentPropertyCacheKey($theme): string 

protected parseComponentSettings()

protected parseComponentSettings(): void 

parseComponentSettings parses component sections Replace the multiple component sections with a single "components" element in the $settings property.

protected parseSettings()

protected parseSettings(): void 

parseSettings array. Child classes can override this method in order to update the content of the $settings property after the object is loaded from a file.

protected validateSettings()

protected validateSettings(): void 

validateSettings if the model is loaded with an invalid INI section, the invalid content will be passed as a special attribute. Look for it, then locate the failure reason.

Show inherited protected methods

Inherited Protected Methods