PropertyContainer
Property container trait
trait System\Traits\PropertyContainer
Adds properties and methods for classes that could define properties, like components or report widgets.
Properties
protected
$properties
:
array
= []
Contains the object property values.
Methods
public defineProperties () : array
Defines the properties used by this class.
This method should be overriden in your extended class and return an array of properties that your class uses, with the keys of the array being the name of the properties, and the values being an array of property parameters.
Example: return [ 'propertyName' => [ 'title' => 'Property name', 'description' => 'Property description', 'default' => 'Default value' ], ];
public getProperties () : array
Returns all properties.
public getPropertyOptions (string $property) : array
Returns options for multi-option properties (drop-downs, etc.)
Property | Type | Description |
---|---|---|
$property | string |
string
Specifies the property name |
Return an array of option values and descriptions
public
property (string $name, string $default = null
)
: mixed
Returns a defined property value or default if one is not set.
Property | Type | Description |
---|---|---|
$name | string |
string
The property name to look for. |
$default | string |
string
A default value to return if no name is found. |
The property value or the default specified.
public setProperties (array $properties) : void
Sets multiple properties.
Property | Type | Description |
---|---|---|
$properties | array |
array
|
public setProperty (string $name, mixed $value) : void
Sets a property value
Property | Type | Description |
---|---|---|
$name | string |
string
|
$value | mixed |
mixed
|
public validateProperties (array $properties) : array
Validates the properties against the defined properties of the class.
This method also sets default properties.
Property | Type | Description |
---|---|---|
$properties | array |
array
The supplied property values. |
The validated property set, with defaults applied.
Used by
Class | Description |
---|---|
Status
|
System status report widget. |
ReportWidgetBase
|
Report Widget base class Report widgets are used inside the ReportContainer. |
Welcome
|
User welcome report widget. |
ComponentBase
|
Component base class |
Resources
|
Resources component |
SoftComponent
|
|
UnknownComponent
|
|
ViewBag
|
The view bag stores custom template properties. |
ActiveTheme
|
Active theme report widget. |