BaseComponent
abstract class BaseComponent extends Extendable
Base Component Class
Traits
Adds event related features to any class.
Extendable Trait Allows for "Private traits"
Properties
protected array | $extensionData | from ExtendableTrait | |
static protected array | $extendableCallbacks | from ExtendableTrait | |
static protected array | $extendableStaticMethods | from ExtendableTrait | |
static protected bool | $extendableGuardProperties | from ExtendableTrait | |
static protected ClassLoader | $extendableClassLoader | from ExtendableTrait | |
$implement | from Extendable | ||
protected array | $emitterSingleEvents | from EventEmitter | |
protected array | $emitterEvents | from EventEmitter | |
protected array | $emitterEventSorted | from EventEmitter | |
array | $assetPath | from AssetMaker | |
protected array | $properties | ||
$defaultPartial | |||
string | $alias | ||
string | $name | ||
bool | $isHidden | ||
string | $extensionIcon | ||
protected string | $dirName | ||
protected | $path | ||
protected MainController | $controller | ||
protected Page | $page |
Methods
Helper method for ::extend() static method
Clear the list of extended classes so they will be re-extended.
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Dynamically extend a class with a specified behavior
Extracts the available methods from a behavior and adds it to the list of callable methods.
Programmatically adds a method to the extendable class
Programatically adds a property to the extendable class
Check if extendable class is extended with a behavior object
Returns a behavior object from an extendable class, example:
Short hand for getClassExtension() method, except takes the short extension name, example:
Checks if a method exists, extension equivalent of method_exists()
Get a list of class methods, extension equivalent of get_class_methods()
Checks if a property exists, extension equivalent of property_exists()
Checks if a property is accessible, property equivalent of is_callabe()
Magic method for __call()
Magic method for __callStatic()
Dynamically handle calls into the controller instance.
Create a new event binding.
Create a new event binding that fires once only
Sort the listeners for a given event by priority.
Fire an event and call the listeners.
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
Validates the properties against the defined properties of the class.
Returns a defined property value or default if one is not set.
Returns options for multi-option properties (drop-downs, etc.)
Returns the absolute component path.
Executed when this component is first initialized, before AJAX requests.
Executed when this component is bound to a layout.
Executed when this component is rendered on a layout.
Renders a requested partial in context of this component,
Executes an AJAX handler.
No description
No description
No description
Details
in
ExtendableTrait at line 55
extendableConstruct()
Constructor.
in
ExtendableTrait at line 103
static void
extendableExtendCallback(callable $callback)
Helper method for ::extend() static method
in
ExtendableTrait at line 120
static void
clearExtendedClasses()
Clear the list of extended classes so they will be re-extended.
in
ExtendableTrait at line 131
protected string
extensionNormalizeClassName(string $name)
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
in
ExtendableTrait at line 149
void|ExtendableTrait
extendClassWith(string $extensionName)
Dynamically extend a class with a specified behavior
in
ExtendableTrait at line 178
protected void
extensionExtractMethods(string $extensionName, object $extensionObject)
Extracts the available methods from a behavior and adds it to the list of callable methods.
in
ExtendableTrait at line 206
addDynamicMethod(string $dynamicName, callable $method, string $extension = null)
Programmatically adds a method to the extendable class
in
ExtendableTrait at line 225
addDynamicProperty(string $dynamicName, string $value = null)
Programatically adds a property to the extendable class
in
ExtendableTrait at line 249
bool
isClassExtendedWith(string $name)
Check if extendable class is extended with a behavior object
in
ExtendableTrait at line 265
mixed
getClassExtension(string $name)
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Admin.Actions.FormController')
in
ExtendableTrait at line 280
mixed
asExtension(string $shortName)
Short hand for getClassExtension() method, except takes the short extension name, example:
$this->asExtension('FormController')
in
ExtendableTrait at line 301
bool
methodExists(string $name)
Checks if a method exists, extension equivalent of method_exists()
in
ExtendableTrait at line 313
array
getClassMethods()
Get a list of class methods, extension equivalent of get_class_methods()
in
ExtendableTrait at line 326
array
getDynamicProperties()
Returns all dynamic properties and their values
in
ExtendableTrait at line 344
bool
propertyExists(string $name)
Checks if a property exists, extension equivalent of property_exists()
in
ExtendableTrait at line 370
protected bool
extendableIsAccessible(mixed $class, string $propertyName)
Checks if a property is accessible, property equivalent of is_callabe()
in
ExtendableTrait at line 385
string
extendableGet(string $name)
Magic method for __get()
in
ExtendableTrait at line 410
string
extendableSet(string $name, string $value)
Magic method for __set()
in
ExtendableTrait at line 444
mixed
extendableCall(string $name, array $params = null)
Magic method for __call()
in
ExtendableTrait at line 483
static mixed
extendableCallStatic(string $name, array $params = null)
Magic method for __callStatic()
in
ExtendableTrait at line 552
protected ClassLoader|null
extensionGetClassLoader()
Gets the class loader
at line 75
__construct(TemplateCode $page = null, array $properties = [])
Class constructor
in
Extendable at line 30
__get($name)
No description
in
Extendable at line 35
__set($name, $value)
No description
at line 177
__call(string $method, array $parameters)
Dynamically handle calls into the controller instance.
in
Extendable at line 45
static
__callStatic($name, $params)
No description
in
Extendable at line 50
static
extend(callable $callback)
No description
in
EventEmitter at line 36
EventEmitter
bindEvent(string $event, callable $callback, int $priority = 0)
Create a new event binding.
in
EventEmitter at line 52
EventEmitter
bindEventOnce(string $event, callable $callback)
Create a new event binding that fires once only
in
EventEmitter at line 66
protected void
emitterEventSortEvents(string $eventName)
Sort the listeners for a given event by priority.
in
EventEmitter at line 84
EventEmitter
unbindEvent(string $event = null)
Destroys an event binding.
in
EventEmitter at line 124
string|array
fireEvent(string $event, array $params = [], bool $halt = false)
Fire an event and call the listeners.
in
EventEmitter at line 178
mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)
Fires a combination of local and global events. The first segment is removed from the event name locally and the local object is passed as the first argument to the event globally. Halting is also enabled by default.
For example:
$this->fireSystemEvent('admin.form.myEvent', ['my value']);
Is equivalent to:
$this->fireEvent('form.myEvent', ['myvalue'], true);
Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);
in
AssetMaker at line 15
flushAssets()
No description
in
AssetMaker at line 30
string
getAssetPath(string $fileName, string $assetPath = null)
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
in
AssetMaker at line 55
addMeta($meta)
No description
in
AssetMaker at line 60
addJs($href, $attributes = null)
No description
in
AssetMaker at line 65
addCss($href, $attributes = null)
No description
in
PropertyContainer at line 20
array
validateProperties(array $properties)
Validates the properties against the defined properties of the class.
This method also sets default properties.
in
PropertyContainer at line 39
defineProperties()
Defines the properties used by this class.
This method should be used as an override in the extended class.
in
PropertyContainer at line 49
setProperties(array $properties)
Sets multiple properties.
in
PropertyContainer at line 59
mergeProperties(array $properties)
Merge multiple properties.
in
PropertyContainer at line 70
setProperty(string $name, mixed $value)
Sets a property value
in
PropertyContainer at line 79
array
getProperties()
Returns all properties.
in
PropertyContainer at line 92
mixed
property(string $name, string $default = null)
Returns a defined property value or default if one is not set.
in
PropertyContainer at line 106
array
getPropertyOptions(string $property)
Returns options for multi-option properties (drop-downs, etc.)
at line 95
getPath()
Returns the absolute component path.
at line 103
initialize()
Executed when this component is first initialized, before AJAX requests.
at line 110
onRun()
Executed when this component is bound to a layout.
at line 117
onRender()
Executed when this component is rendered on a layout.
at line 126
mixed
renderPartial()
Renders a requested partial in context of this component,
at line 138
runEventHandler($handler)
Executes an AJAX handler.
at line 147
getEventHandler($handler)
No description
at line 156
param($name, $default = null)
No description
at line 195
__toString()
No description