Documentation

ComponentManager
in package
Uses Singleton

Component manager

Tags
author

Alexey Bobkov, Samuel Georges

Table of Contents

$callbacks  : array<string|int, mixed>
$classMap  : array<string|int, mixed>
$codeMap  : array<string|int, mixed>
$detailsCache  : array<string|int, mixed>
$instance  : mixed
$pluginMap  : array<string|int, mixed>
__clone()  : mixed
__wakeup()  : mixed
findComponentPlugin()  : mixed
Returns a parent plugin for a specific component object.
forgetInstance()  : mixed
Forget this singleton's instance if it exists
hasComponent()  : bool
Checks to see if a component has been registered.
instance()  : mixed
Create a new instance of this singleton.
listComponentDetails()  : array<string|int, mixed>
Returns an array of all component detail definitions.
listComponents()  : array<string|int, mixed>
Returns a list of registered components.
makeComponent()  : ComponentBase
Makes a component object with properties set.
registerComponent()  : mixed
Registers a single component.
registerComponents()  : array<string|int, mixed>
Manually registers a component for consideration. Usage:
resolve()  : string
Returns a class name from a component code Normalizes a class name or converts an code to it's class name.
__construct()  : mixed
Constructor.
init()  : mixed
Initialize the singleton free from constructor parameters.
loadComponents()  : void
Scans each plugin an loads it's components.

Properties

$callbacks

protected array<string|int, mixed> $callbacks = []

Cache of registration callbacks.

$classMap

protected array<string|int, mixed> $classMap

An array where keys are class names and values are codes.

$codeMap

protected array<string|int, mixed> $codeMap

An array where keys are codes and values are class names.

$detailsCache

protected array<string|int, mixed> $detailsCache

A cached array of component details.

$pluginMap

protected array<string|int, mixed> $pluginMap

An array containing references to a corresponding plugin for each component class.

Methods

__clone()

public __clone() : mixed
Return values
mixed

__wakeup()

public __wakeup() : mixed
Return values
mixed

findComponentPlugin()

Returns a parent plugin for a specific component object.

public findComponentPlugin(mixed $component) : mixed
Parameters
$component : mixed

A component to find the plugin for.

Return values
mixed

Returns the plugin object or null.

forgetInstance()

Forget this singleton's instance if it exists

public final static forgetInstance() : mixed
Return values
mixed

hasComponent()

Checks to see if a component has been registered.

public hasComponent(string $name) : bool
Parameters
$name : string

A component class name or code.

Return values
bool

Returns true if the component is registered, otherwise false.

instance()

Create a new instance of this singleton.

public final static instance() : mixed
Return values
mixed

listComponentDetails()

Returns an array of all component detail definitions.

public listComponentDetails() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array keys are component codes, values are the details defined in the component.

listComponents()

Returns a list of registered components.

public listComponents() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array keys are codes, values are class names.

makeComponent()

Makes a component object with properties set.

public makeComponent(string $name[, CmsObject $cmsObject = null ][, array<string|int, mixed> $properties = [] ][, bool $isSoftComponent = false ]) : ComponentBase
Parameters
$name : string

A component class name or code.

$cmsObject : CmsObject = null

The Cms object that spawned this component.

$properties : array<string|int, mixed> = []

The properties set by the Page or Layout.

$isSoftComponent : bool = false

Defines if this is a soft component.

Tags
throws
SystemException

If the (hard) component cannot be found or is not registered.

Return values
ComponentBase

The component object.

registerComponent()

Registers a single component.

public registerComponent(mixed $className[, mixed $code = null ][, mixed $plugin = null ]) : mixed
Parameters
$className : mixed
$code : mixed = null
$plugin : mixed = null
Return values
mixed

registerComponents()

Manually registers a component for consideration. Usage:

public registerComponents(callable $definitions) : array<string|int, mixed>

ComponentManager::registerComponents(function ($manager) { $manager->registerComponent('October\Demo\Components\Test', 'testComponent'); });

Parameters
$definitions : callable
Return values
array<string|int, mixed>

Array values are class names.

resolve()

Returns a class name from a component code Normalizes a class name or converts an code to it's class name.

public resolve(mixed $name) : string
Parameters
$name : mixed
Return values
string

The class name resolved, or null.

__construct()

Constructor.

protected final __construct() : mixed
Return values
mixed

init()

Initialize the singleton free from constructor parameters.

protected init() : mixed
Return values
mixed

loadComponents()

Scans each plugin an loads it's components.

protected loadComponents() : void
Return values
void

Search results