Contents

Cms\Classes\ComponentBehavior

Overview

ComponentBehavior base class for CMS component behaviors.

Analogous to Backend\Classes\ControllerBehavior but adapted for CMS components. Behaviors are attached to components via the $implement property and provide reusable functionality such as form handling and list rendering.

Extends

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected ComponentBase $component

component class

protected Cms\Classes\Controller $controller

controller to CMS controller.

protected array $requiredProperties

requiredProperties that must exist in the component using this behavior

protected string $configPath

configPath specifies a path to the config directory.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __construct()

public __construct($component): void

__construct the behavior

public beforeDisplay()

public beforeDisplay(): void

beforeDisplay fires before the page is displayed and AJAX is executed.

public getConfigPath()

public getConfigPath(
    string $fileName,
    mixed $configPath = null
): string 

getConfigPath locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

public guessConfigPath()

public guessConfigPath(string $suffix = ''): string 

guessConfigPath guesses the package path for the called class.

public guessConfigPathFrom()

public guessConfigPathFrom(string $class, string $suffix = ''): string 

guessConfigPathFrom guesses the package path from a specified class.

public makeConfig()

public makeConfig(
    mixed $configFile = [],
    array $requiredConfig = []
): object 

makeConfig reads the contents of the supplied file and applies it to this object.

public makeConfigFromArray()

public makeConfigFromArray(array $configArray = []): stdClass 

makeConfigFromArray makes a config object from an array, making the first level keys properties of a new object.

public mergeConfig()

public mergeConfig(mixed $configA, mixed $configB): stdClass 

mergeConfig merges two configuration sources, either prepared or not, and returns them as a single configuration object.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected getConfigValueFrom()

protected getConfigValueFrom($configObj, $name = null, $default = null): void

getConfigValueFrom will apply the config getter convention

Show inherited protected methods

Inherited Protected Methods