ExtendableTrait
This extension trait is used when access to the underlying base class
is not available, such as classes that belong to the foundation
framework (Laravel). It is currently used by the Controller and
Model classes.
trait Winter\Storm\Extension\ExtendableTrait
Properties
protected
static
$extendableCallbacks
:
array
= []
Used to extend the constructor of an extendable class. Eg:
Class::extend(function($obj) { })
protected
static
$extendableClassLoader
:
ClassLoader
|
null
= null
Class loader instance.
protected
static
$extendableStaticMethods
:
array
= []
Collection of static methods used by behaviors.
protected
$extensionData
:
array
= {"extensions":[],"methods":[],"dynamicMethods":[],"dynamicProperties":[]}
Class reflection information, including behaviors.
Methods
public
addDynamicMethod (string $dynamicName, callable $method, string $extension = null
)
Programmatically adds a method to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
|
$method | callable |
callable
|
$extension | string |
string
|
public
addDynamicProperty (string $dynamicName, mixed $value = null
)
: void
Programmatically adds a property to the extendable class
Property | Type | Description |
---|---|---|
$dynamicName | string |
string
The name of the property to add |
$value | mixed |
mixed
The value of the property |
public asExtension (string $shortName) : mixed
Short hand for getClassExtension()
method, except takes the short
extension name, example:
$this->asExtension('FormController')
Property | Type | Description |
---|---|---|
$shortName | string |
string
|
public static clearExtendedClasses () : void
Clear the list of extended classes so they will be re-extended.
public extendClassWith (string $extensionName) : void
Dynamically extend a class with a specified behavior
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
public
extendableCall (string $name, array $params = null
)
: mixed
Magic method for __call()
.
Callback priority is as follows:
- "Dynamic Methods" added locally to the object via addDynamicMethod($name, $callable)
- Methods available on Behaviors that have been implemented by the object
- Pass it to the parent's __call() method if it defines one
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
public
static
extendableCallStatic (string $name, array $params = null
)
: mixed
Magic method for __callStatic()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$params | array |
array
|
public extendableConstruct ()
This method should be called as part of the constructor.
public
static
extendableExtendCallback (callable $callback, boolean $scoped = false
, $outerScope = null
)
: void
Helper method for ::extend()
static method.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
$scoped | boolean |
boolean
|
$outerScope | mixed |
mixed
|
public extendableGet (string $name) : mixed | null
Magic method for __get()
Property | Type | Description |
---|---|---|
$name | string |
string
|
public extendableSet (string $name, mixed $value) : void
Magic method for __set()
Property | Type | Description |
---|---|---|
$name | string |
string
|
$value | mixed |
mixed
|
public getClassExtension (string $name) : mixed
Returns a behavior object from an extendable class, example:
$this->getClassExtension('Backend.Behaviors.FormController')
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
public getClassMethods () : array
Get a list of class methods, extension equivalent of get_class_methods()
public getDynamicProperties () : array
Returns all dynamic properties and their values
['property' => 'value']
public isClassExtendedWith (string $name) : bool
Check if extendable class is extended with a behavior object
Property | Type | Description |
---|---|---|
$name | string |
string
Fully qualified behavior name |
public methodExists (string $name) : bool
Checks if a method exists, extension equivalent of method_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
public propertyExists (string $name) : bool
Checks if a property exists, extension equivalent of property_exists()
Property | Type | Description |
---|---|---|
$name | string |
string
|
protected extendableIsAccessible (mixed $class, string $propertyName) : bool
Checks if a property is accessible, property equivalent of is_callable()
Property | Type | Description |
---|---|---|
$class | mixed |
mixed
|
$propertyName | string |
string
|
protected extensionCallMethod (ReflectionClass $class, string $method, array $params)
Calls a method through reflection.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$method | string |
string
|
$params | array |
array
|
protected extensionExtractMethods (string $extensionName, object $extensionObject) : void
Extracts the available methods from a behavior and adds it to the list of callable methods.
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
$extensionObject | object |
object
|
protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null
Gets the class loader
protected
extensionGetParentClass ($instance = null
)
: ReflectionClass | false
Gets the parent class using reflection.
The parent class must either not be the Extendable
class, or must not be using the ExtendableTrait
trait,
in order to prevent infinite loops.
Property | Type | Description |
---|---|---|
$instance | mixed |
mixed
|
protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool
Determines if the given class reflection contains the given method.
Property | Type | Description |
---|---|---|
$class | ReflectionClass |
ReflectionClass
|
$methodName | string |
string
|
protected extensionNormalizeClassName (string $name) : string
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Property | Type | Description |
---|---|---|
$name | string |
string
|
Used by
Class | Description |
---|---|
EventLogs
|
Event Logs controller |
MailBrandSettings
|
Mail brand customization controller |
MailLayouts
|
Mail layouts controller |
MailPartials
|
Mail partials controller |
MailTemplates
|
Mail templates controller |
RequestLogs
|
Request Logs controller |
Settings
|
Settings controller |
Updates
|
Updates controller |
File
|
File attachment model |
Parameter
|
Parameters model Used for storing internal application parameters. |
Revision
|
Revision history model |
Status
|
System status report widget. |
BackendController
|
This is the master controller for all back-end pages. |
Controller
|
The Backend base controller class, used by Backend controllers. |
FormWidgetBase
|
Form Widget base class Widgets used specifically for forms |
ReportWidgetBase
|
Report Widget base class Report widgets are used inside the ReportContainer. |
WidgetBase
|
Widget base class. |
AccessLogs
|
Access Logs controller |
Auth
|
Authentication controller |
Files
|
Backend files controller |
Index
|
Dashboard controller |
Media
|
Backend Media Manager |
Preferences
|
Editor Settings controller |
UserGroups
|
Backend user groups controller |
UserRoles
|
Backend user groups controller |
Users
|
Backend user controller |
CodeEditor
|
Code Editor Renders a code editor field. |
ColorPicker
|
Color picker Renders a color picker field. |
DataTable
|
Data Table Renders a table field. |
DatePicker
|
Date picker Renders a date picker field. |
FileUpload
|
File upload field Renders a form file uploader field. |
IconPicker
|
Icon picker Renders an icon picker field. |
MarkdownEditor
|
Code Editor Renders a code editor field. |
MediaFinder
|
Media Finder Renders a record finder field. |
NestedForm
|
Nested Form Renders a nested form bound to a jsonable field of a model. |
PermissionEditor
|
User/group permission editor This widget is used by the system internally on the System / Administrators pages. |
RecordFinder
|
Record Finder Renders a record finder field. |
Relation
|
Form Relationship Renders a field prepopulated with a belongsTo and belongsToHasMany relation. |
RelationManager
|
|
Repeater
|
Repeater Form Widget |
RichEditor
|
Rich Editor Renders a rich content editor field. |
Sensitive
|
Sensitive widget. |
TagList
|
Tag List Form Widget |
User
|
Administrator user model |
UserGroup
|
Administrator group |
UserPreference
|
All preferences for the backend user |
UserRole
|
Administrator role |
UserThrottle
|
Administrator throttling model |
Welcome
|
User welcome report widget. |
Filter
|
Filter Widget Renders a container used for filtering things. |
Form
|
Form Widget Used for building back end forms and renders a form. |
Lists
|
List Widget Used for building back end lists, renders a list of model objects |
MediaManager
|
Media Manager widget. |
ReportContainer
|
Report Container Widget Creates an area hosting report widgets. |
Search
|
Search Widget Used for building a toolbar, Renders a search container. |
Table
|
Table Widget. |
Toolbar
|
Toolbar Widget Used for building a toolbar, renders a toolbar. |
Asset
|
The CMS theme asset file class. |
CmsCompoundObject
|
This is a base class for CMS objects that have multiple sections - pages, partials and layouts. |
CmsController
|
This is the master controller for all front-end pages. |
CmsObject
|
This is a base class for all CMS objects - content files, pages, partials and layouts. |
CodeBase
|
Parent class for PHP classes created for layout and page code sections. |
ComponentBase
|
Component base class |
ComponentPartial
|
The CMS component partial class. These objects are read-only. |
Content
|
The CMS content file class. |
Layout
|
The CMS layout class. |
LayoutCode
|
Parent class for PHP classes created for layout PHP sections. |
Meta
|
The CMS meta file class, used for interacting with YAML files within the Halcyon datasources |
Page
|
The CMS page class. |
PageCode
|
Parent class for PHP classes created for page PHP sections. |
Partial
|
The CMS partial class. |
PartialCode
|
Parent class for PHP classes created for partial PHP sections. |
Theme
|
This class represents the CMS theme. |
Resources
|
Resources component |
SoftComponent
|
|
UnknownComponent
|
|
ViewBag
|
The view bag stores custom template properties. |
Index
|
CMS index |
Media
|
CMS Media Manager |
ThemeLogs
|
Request Logs controller |
ThemeOptions
|
Theme customization controller |
Themes
|
Theme selector controller |
Components
|
Component Builder Builds a collection of Cms components and configures them. |
MediaFinder
|
Media Finder Renders a record finder field. |
ActiveTheme
|
Active theme report widget. |
AssetList
|
CMS asset list widget. |
ComponentList
|
Component list widget. |
MediaManager
|
Media Manager widget. |
TemplateList
|
Template list widget. |
Group
|
Group model |
Preferences
|
User Preferences model |
Role
|
Role model |
Throttle
|
Throttle model |
User
|
User model |
File
|
File attachment model |
Model
|
Active Record base class. |
DeferredBinding
|
Deferred Binding Model |
Revision
|
Revision Model |
MorphPivot
|
Reimplementation of \Illuminate\Database\Eloquent\Relations\MorphPivot but extends Winter's Pivot base class instead of Laravel's to get access to Winter magic. |
Pivot
|
|
Extendable
|
Extension class |
Model
|
This is a base template object. Equivalent to a Model in ORM. |