Form

Form Widget Used for building back end forms and renders a form.

 class Backend\Widgets\Form
extends Backend\Classes\WidgetBase

Extends

Class Description
WidgetBase

Widget base class.

Traits

Trait Description
AssetMaker

Asset Maker Trait Adds asset based methods to a class

ConfigMaker

Config Maker Trait Adds configuration based methods to a class

ErrorMaker

Error Maker Trait Adds exception based methods to a class, goes well with System\Traits\ViewMaker.

EventEmitter

Adds system event related features to any class.

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.

FormModelSaver

Implements special logic for processing form data, typically from from postback, and filling the model attributes and attributes of any related models. This is a customized, safer and simplified version of $model->push().

SessionMaker

Session Maker Trait

ViewMaker

View Maker Trait Adds view based methods to a class

WidgetMaker

Widget Maker Trait

Properties

public $arrayName : string

If the field element names should be contained in an array. Eg:

public $context : string

The context of this form, fields that do not belong to this context will not be shown.

public $data : array

Dataset containing field values, if none supplied, model is used.

public $fields : array

Form field configuration.

public $isNested : bool

Used to flag that this form is being rendered as part of another form, a good indicator to expect that the form model and dataset values will differ.

public $model : Model

Form model object.

public $previewMode : bool

Render this form with uneditable preview data.

public $secondaryTabs : array

Secondary tab configuration.

public $sessionKey : string

Active session key, used for editing forms and deferred bindings.

public $tabs : array

Primary tab configuration.

protected $allFields : array

Collection of all fields used in this form.

protected $allTabs : object

Collection of tab sections used in this form.

protected $defaultAlias : mixed

A unique alias to identify this widget.

protected $fieldsDefined : bool

Determines if field definitions have been created.

protected $formWidgets : array

Collection of all form widgets used in this form.

protected $widgetManager : Backend\Classes\WidgetManager

inherited public $alias : string

Inherited from WidgetBase

Defined alias used for this widget.

inherited public $assetPath : string

Inherited from WidgetBase

Specifies a path to the asset directory.

inherited public $config : object

Inherited from WidgetBase

Supplied configuration.

inherited public $implement : string | array | null

Inherited from WidgetBase

Extensions implemented by this class.

inherited public $layout : string

Inherited from WidgetBase

Layout to use for the view.

inherited public $suppressLayout : bool

Inherited from WidgetBase

Prevents the use of a layout.

inherited public $vars : array

Inherited from WidgetBase

A list of variables to pass to the page.

inherited protected $assets : array

Inherited from WidgetBase

Collection of assets to display in the layout.

inherited protected $configPath : string

Inherited from WidgetBase

Specifies a path to the config directory.

inherited protected $controller : Backend\Classes\Controller

Inherited from WidgetBase

Backend controller object.

inherited protected static $extendableCallbacks : array

Inherited from WidgetBase

Used to extend the constructor of an extendable class. Eg:

Class::extend(function($obj) { })

inherited protected static $extendableClassLoader : ClassLoader | null

Inherited from WidgetBase

Class loader instance.

inherited protected $extendableConstructed : bool

Inherited from WidgetBase

Indicates if the extendable constructor has completed.

inherited protected static $extendableStaticMethods : array

Inherited from WidgetBase

Collection of static methods used by behaviors.

inherited protected $extensionData : array

Inherited from WidgetBase

Class reflection information, including behaviors.

inherited protected $fatalError : string

Inherited from WidgetBase

Object used for storing a fatal error.

inherited protected $layoutPath : string

Inherited from WidgetBase

Specifies a path to the layout directory.

inherited protected $localCallbacks : array

Inherited from WidgetBase

This stores any locally-scoped callbacks fired before the extendable constructor had completed.

inherited protected $modelsToSave : array

Inherited from FormModelSaver

List of prepared models that require saving.

inherited protected $orderFactor : integer

Inherited from WidgetBase

Ensures "first-come, first-served" applies to assets of the same ordering.

inherited protected $viewPath : string | array

Inherited from WidgetBase

Specifies a path to the views directory.

Methods

public addFields (array $fields, string $addToArea = null) : void

Programatically add fields, used internally and for extensibility.

Parameters
Property Description
$fields
array
$addToArea
string
Returns
void

public addSecondaryTabFields (array $fields) : void

Parameters
Property Description
$fields
array
Returns
void

public addTabFields (array $fields) : void

Add tab fields.

Parameters
Property Description
$fields
array
Returns
void

public bindToController () : void

Ensure fields are defined and form widgets are registered so they can also be bound to the controller this allows their AJAX features to operate.

Returns
void

public getContext () : string

Returns the active context for displaying the form.

Returns
string

public getField (string $field) : mixed

Get a specified field object

Parameters
Property Description
$field
string
Returns
mixed

public getFields () : array

Get all the registered fields for the instance.

Returns
array

public getFormWidget (string $field) : mixed

Get a specified form widget

Parameters
Property Description
$field
string
Returns
mixed

public getFormWidgets () : array

Get all the loaded form widgets for the instance.

Returns
array

public getOptionsFromModel (mixed $field, mixed $fieldOptions) : mixed

Looks at the model for defined options.

Parameters
Property Description
$field
mixed
$fieldOptions
mixed
Returns
mixed

public getSaveData (boolean $includeAllFields = false) : array

Returns post data from a submitted form.

Parameters
Property Description
$includeAllFields
boolean
Returns
array

public getSessionKey () : Illuminate\Routing\Route | mixed | string

Returns the active session key.

Returns
Illuminate\Routing\Route | mixed | string

public getTab ($tab) : mixed

Get a specified tab object.

Options: outside, primary, secondary.

Parameters
Property Description
$tab
mixed
Returns
mixed

public getTabs () : mixed

Get all tab objects for the instance.

Returns
mixed

public init ()

Initialize the widget, called by the constructor and free from its parameters.

Returns
mixed

public nameToId (mixed $input) : string

Helper method to convert a field name to a valid ID attribute.

Parameters
Property Description
$input
mixed
Returns
string

public onLazyLoadTab () : array

Renders all fields of a tab in the target tab-pane.

Returns
array

public onRefresh () : array

Event handler for refreshing the form.

Returns
array

public removeField (string $name) : bool

Programatically remove a field.

Parameters
Property Description
$name
string
Returns
bool

public removeTab (string $name) : bool

Programatically remove all fields belonging to a tab.

Parameters
Property Description
$name
string
Returns
bool

public render (array $options = []) : string | bool

Renders the widget.

Options:

  • preview: Render this form as an uneditable preview. Default: false
  • useContainer: Wrap the result in a container, used by AJAX. Default: true
  • section: Which form section to render. Default: null
    • outside: Renders the Outside Fields section.
    • primary: Renders the Primary Tabs section.
    • secondary: Renders the Secondary Tabs section.
    • null: Renders all sections
Parameters
Property Description
$options
array
Returns
string | bool

The rendered partial contents, or false if suppressing an exception

public renderField (string | array $field, array $options = []) : string | bool

Renders a single form field

Options:

  • useContainer: Wrap the result in a container, used by AJAX. Default: true
Parameters
Property Description
$field
string | array

The field name or definition

$options
array
Returns
string | bool

The rendered partial contents, or false if suppressing an exception

public renderFieldElement (FormWidgetBase $field) : string | bool

Renders the HTML element for a field

Parameters
Property Description
$field
Returns
string | bool

The rendered partial contents, or false if suppressing an exception

public setFormValues (array $data = null) : array

Sets or resets form field values.

Parameters
Property Description
$data
array
Returns
array

protected applyFiltersFromModel ()

Returns
mixed

protected dataArrayGet (array $array, array $parts, null $default = null) : array | null

Variant to array_get() but preserves dots in key names.

Parameters
Property Description
$array
array
$parts
array
$default
null
Returns
array | null

protected dataArraySet (array $array, array $parts, string $value) : array

Variant to array_set() but preserves dots in key names.

Parameters
Property Description
$array
array
$parts
array
$value
string
Returns
array

protected defineFormFields () : void

Creates a flat array of form fields from the configuration.

Also slots fields in to their respective tabs.

Returns
void

protected getFieldDepends (Backend\Classes\FormField $field) : string

Returns a HTML encoded value containing the other fields this field depends on

Parameters
Property Description
$field
Returns
string

protected getFieldName (string $field) : array

Parses a field's name

Parameters
Property Description
$field
string

Field name

Returns
array

[columnName, context]

protected getFieldValue (mixed $field) : string

Looks up the field value.

Parameters
Property Description
$field
mixed
Returns
string

protected isFormWidget (string $fieldType) : bool

Check if a field type is a widget or not

Parameters
Property Description
$fieldType
string
Returns
bool

protected loadAssets ()

Adds widget specific asset files. Use $this->addJs() and $this->addCss() to register new assets to include on the page.

Returns
mixed

protected makeFormField (string $name, array $config = []) : FormField

Creates a form field object from name and configuration.

Parameters
Property Description
$name
string
$config
array
Returns

protected makeFormFieldWidget (mixed $field) : Backend\Traits\FormWidgetBase | null

Makes a widget object from a form field object.

Parameters
Property Description
$field
mixed
Returns
Backend\Traits\FormWidgetBase | null

protected objectMethodExists (object $object, string $method) : bool

Internal helper for method existence checks.

Parameters
Property Description
$object
object
$method
string
Returns
bool

protected prepareVars () : void

Prepares the form data

Returns
void

protected processAutoSpan ($fields) : void

Converts fields with a span set to 'auto' as either 'left' or 'right' depending on the previous field.

Parameters
Property Description
$fields
mixed
Returns
void

protected shouldFetchDefaultValues ()

Checks if default values should be taken from data.

This should be done when the model does not exist or when explicitly configured

Returns
mixed

protected showFieldLabels (Backend\Classes\FormField $field) : bool

Helper method to determine if field should be rendered with label and comments.

Parameters
Property Description
$field
Returns
bool

protected validateModel () : mixed

Validate the supplied form model.

Returns
mixed

inherited public __call ($name, $params)

Inherited from WidgetBase
Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

inherited public static __callStatic ($name, $params)

Inherited from WidgetBase
Parameters
Property Description
$name
mixed
$params
mixed
Returns
mixed

inherited public __construct (Backend\Classes\Controller $controller, array $configuration = [])

Inherited from WidgetBase

Constructor

Parameters
Property Description
$controller
$configuration
array

Proactive configuration definition.

Returns
mixed

inherited public __get ($name)

Inherited from WidgetBase
Parameters
Property Description
$name
mixed
Returns
mixed

inherited public __set ($name, $value)

Inherited from WidgetBase
Parameters
Property Description
$name
mixed
$value
mixed
Returns
mixed

inherited public addCss (string | array $name, array $attributes = []) : void

Inherited from WidgetBase

Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

Parameters
Property Description
$name
string | array

When an array of paths are provided they will be passed to the Asset Combiner

$attributes
array

When a string is provided it will be used as the 'build' attribute value

Returns
void

inherited public addDynamicMethod (string $dynamicName, callable $method, string $extension = null)

Inherited from WidgetBase

Programmatically adds a method to the extendable class

Parameters
Property Description
$dynamicName
string
$method
callable
$extension
string
Returns
mixed

inherited public addDynamicProperty (string $dynamicName, mixed $value = null) : void

Inherited from WidgetBase

Programmatically adds a property to the extendable class

Parameters
Property Description
$dynamicName
string

The name of the property to add

$value
mixed

The value of the property

Returns
void

inherited public addJs (string | array $name, array $attributes = []) : void

Inherited from WidgetBase

Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

Parameters
Property Description
$name
string | array

When an array of paths are provided they will be passed to the Asset Combiner

$attributes
array

When a string is provided it will be used as the 'build' attribute value

Returns
void

inherited public addRss (string $name, array $attributes = []) : void

Inherited from WidgetBase

Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.

Parameters
Property Description
$name
string
$attributes
array
Returns
void

inherited public addViewPath (string | array $path) : void

Inherited from WidgetBase

Prepends a path on the available view path locations.

Parameters
Property Description
$path
string | array
Returns
void

inherited public addVite (array | string $entrypoints, ?string $package = null) : void

Inherited from WidgetBase

Adds Vite tags

Parameters
Property Description
$entrypoints
array | string

The list of entry points for Vite

$package
?string

The package name of the plugin or theme

Returns
void

inherited public asExtension (string $shortName) : mixed

Inherited from WidgetBase

Short hand for getClassExtension() method, except takes the short extension name, example:

$this->asExtension('FormController')

Parameters
Property Description
$shortName
string
Returns
mixed

inherited public static clearExtendedClasses () : void

Inherited from WidgetBase

Clear the list of extended classes so they will be re-extended.

Returns
void

inherited public combineAssets (array $assets, string $localPath = "") : string

Inherited from WidgetBase

Run the provided assets through the Asset Combiner

Parameters
Property Description
$assets
array
$localPath
string
Returns
string

inherited public extendClassWith (string $extensionName) : void

Inherited from WidgetBase

Dynamically extend a class with a specified behavior

Parameters
Property Description
$extensionName
string
Returns
void

inherited public static extendableAddExtension (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from WidgetBase

Extends the class using a closure.

The closure will be provided a single parameter which is the instance of the extended class, by default.

You may optionally specify the callback as a scoped callback, which inherits the scope of the extended class and provides access to protected and private methods and properties. This makes any call using $this act on the extended class, not the class providing the extension.

If you use a scoped callback, you can provide the "outer" scope - or the scope of the class providing the extension, with the third parameter. The outer scope object will then be passed as the single parameter to the closure.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableCall (string $name, array $params = null) : mixed

Inherited from WidgetBase

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
Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public static extendableCallStatic (string $name, array $params = null) : mixed

Inherited from WidgetBase

Magic method for __callStatic()

Parameters
Property Description
$name
string
$params
array
Returns
mixed

inherited public extendableConstruct ()

Inherited from WidgetBase

This method should be called as part of the constructor.

Returns
mixed

inherited public static extendableExtendCallback (callable $callback, boolean $scoped = false, $outerScope = null) : void

Inherited from WidgetBase

Helper method for ::extend() static method.

Parameters
Property Description
$callback
callable
$scoped
boolean
$outerScope
mixed
Returns
void

inherited public extendableGet (string $name) : mixed | null

Inherited from WidgetBase

Magic method for __get()

Parameters
Property Description
$name
string
Returns
mixed | null

inherited public extendableSet (string $name, mixed $value) : void

Inherited from WidgetBase

Magic method for __set()

Parameters
Property Description
$name
string
$value
mixed
Returns
void

inherited public fireSystemEvent (string $event, array $params = [], boolean $halt = true) : mixed

Inherited from WidgetBase

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('backend.list.myEvent', ['my value']);

Is equivalent to:

$this->fireEvent('list.myEvent', ['myvalue'], true);

Event::fire('backend.list.myEvent', [$this, 'myvalue'], true);
Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

$halt
boolean

Halt after first non-null result

Returns
mixed

inherited public fireViewEvent (string $event, array $params = []) : string

Inherited from WidgetBase

Special event function used for extending within view files, allowing HTML to be injected multiple times.

For example:

= $this->fireViewEvent('backend.auth.extendSigninView') ?>
Parameters
Property Description
$event
string

Event name

$params
array

Event parameters

Returns
string

inherited public flushAssets () : void

Inherited from WidgetBase

Disables the use, and subequent broadcast, of assets. This is useful to call during an AJAX request to speed things up. This method works by specifically targeting the hasAssetsDefined method.

Returns
void

inherited public getAssetPath (string $fileName, $assetPath = null) : string

Inherited from WidgetBase

Returns the URL to the provided asset. If the provided fileName is a relative path without a leading slash it will be assumbed to be relative to the asset path.

Parameters
Property Description
$fileName
string
$assetPath
mixed
Returns
string

inherited public getAssetPaths () : array

Inherited from WidgetBase

Returns an array of all registered asset paths.

Assets will be prioritized based on their defined ordering.

Returns
array

inherited public getClassExtension (string $name) : mixed

Inherited from WidgetBase

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Backend.Behaviors.FormController')

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
mixed

inherited public getClassMethods () : array

Inherited from WidgetBase

Get a list of class methods, extension equivalent of get_class_methods()

Returns
array

inherited public getConfig (string $name, string $default = null) : string

Inherited from WidgetBase

Safe accessor for configuration values.

Parameters
Property Description
$name
string

Config name, supports array names like "field[key]"

$default
string

Default value if nothing is found

Returns
string

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

Inherited from WidgetBase

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.

Parameters
Property Description
$fileName
string

File to load.

$configPath
mixed

Explicitly define a config path.

Returns
string

Full path to the config file.

inherited public getController ()

Inherited from WidgetBase

Returns the controller using this widget.

Returns
mixed

inherited public getDynamicProperties () : array

Inherited from WidgetBase

Returns all dynamic properties and their values

Returns
array

['property' => 'value']

inherited public getEventHandler (string $name) : string

Inherited from WidgetBase

Returns a fully qualified event handler name for this widget.

Parameters
Property Description
$name
string

The ajax event handler name.

Returns
string

inherited public getFatalError () : string

Inherited from WidgetBase
Returns
string

The fatal error message

inherited public getId (string $suffix = null) : string

Inherited from WidgetBase

Returns a unique ID for this widget. Useful in creating HTML markup.

Parameters
Property Description
$suffix
string

An extra string to append to the ID.

Returns
string

A unique identifier.

inherited public getViewPath (string $fileName, $viewPaths = null) : string

Inherited from WidgetBase

Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.

If the fileName cannot be found it will be returned unmodified.

Parameters
Property Description
$fileName
string
$viewPaths
mixed
Returns
string

inherited public getViewPaths () : array

Inherited from WidgetBase

Returns the active view path locations.

Returns
array

inherited public guessConfigPath (string $suffix = "") : string

Inherited from WidgetBase

Guess the package path for the called class.

Parameters
Property Description
$suffix
string

An extra path to attach to the end

Returns
string

inherited public guessConfigPathFrom (string $class, string $suffix = "") : string

Inherited from WidgetBase

Guess the package path from a specified class.

Parameters
Property Description
$class
string

Class to guess path from.

$suffix
string

An extra path to attach to the end

Returns
string

inherited public guessViewPath (string $suffix = "", boolean $isPublic = false) : string | null

Inherited from WidgetBase

Guess the package path for the called class.

Parameters
Property Description
$suffix
string

An extra path to attach to the end

$isPublic
boolean

Returns public path instead of an absolute one

Returns
string | null

inherited public guessViewPathFrom (string $class, string $suffix = "", boolean $isPublic = false) : string | null

Inherited from WidgetBase

Guess the package path from a specified class.

Parameters
Property Description
$class
string

Class to guess path from.

$suffix
string

An extra path to attach to the end

$isPublic
boolean

Returns public path instead of an absolute one

Returns
string | null

inherited public handleError ($exception)

Inherited from WidgetBase

Sets standard page variables in the case of a controller error.

Parameters
Property Description
$exception
mixed
Returns
mixed

inherited public hasAssetsDefined () : bool

Inherited from WidgetBase

Returns true if assets any have been added.

Returns
bool

inherited public hasFatalError () : bool

Inherited from WidgetBase
Returns
bool

Whether a fatal error has been set or not.

inherited public isClassExtendedWith (string $name) : bool

Inherited from WidgetBase

Check if extendable class is extended with a behavior object

Parameters
Property Description
$name
string

Fully qualified behavior name

Returns
bool

inherited public makeAssets ($type = null) : string | null

Inherited from WidgetBase

Outputs <link> and <script> tags to load assets previously added with addJs, addCss, & addRss method calls depending on the provided $type

Parameters
Property Description
$type
mixed
Returns
string | null

inherited public makeConfig (array $configFile = [], array $requiredConfig = []) : array | stdClass

Inherited from WidgetBase

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

Parameters
Property Description
$configFile
array
$requiredConfig
array
Returns
array | stdClass

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

Inherited from WidgetBase

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

Parameters
Property Description
$configArray
array

Config array.

Returns
stdClass

The config object

inherited public makeFileContents (string $filePath, array $extraParams = []) : string

Inherited from WidgetBase

Includes a file path using output buffering, making the provided vars available.

Parameters
Property Description
$filePath
string
$extraParams
array
Returns
string

inherited public makeFormWidget (string $class, array $fieldConfig = [], array $widgetConfig = []) : Backend\Classes\FormWidgetBase

Inherited from WidgetBase

Makes a form widget object with the supplied form field and widget configuration.

Parameters
Property Description
$class
string

Widget class name

$fieldConfig
array

A field name, an array of config or a FormField object.

$widgetConfig
array

An array of config.

Returns

The widget object

inherited public makeLayout ($name = null, array $params = [], boolean $throwException = true) : string | bool

Inherited from WidgetBase

Render a layout, defaulting to the layout propery specified on the class

Parameters
Property Description
$name
mixed
$params
array
$throwException
boolean
Returns
string | bool

The layout contents, or false.

inherited public makeLayoutPartial (string $partial, array $params = []) : string

Inherited from WidgetBase

Renders a layout partial

Parameters
Property Description
$partial
string
$params
array
Returns
string

inherited public makePartial (string $partial, array $params = [], boolean $throwException = true) : mixed

Inherited from WidgetBase

Render a partial file contents located in the views folder.

Parameters
Property Description
$partial
string
$params
array
$throwException
boolean
Returns
mixed

Partial contents or false if not throwing an exception.

inherited public makeView (string $view) : string

Inherited from WidgetBase

Loads the specified view. Applies the layout if one is set.

The view file must have the .php extension (or ".htm" for historical reasons) and be located in the views directory

Parameters
Property Description
$view
string
Returns
string

inherited public makeViewContent (string $contents, $layout = null) : string

Inherited from WidgetBase

Renders supplied contents inside a layout.

Parameters
Property Description
$contents
string
$layout
mixed
Returns
string

inherited public makeWidget (string $class, array $widgetConfig = []) : mixed | Backend\Classes\WidgetBase

Inherited from WidgetBase

Makes a widget object with the supplied configuration file.

Parameters
Property Description
$class
string

Widget class name

$widgetConfig
array

An array of config.

Returns

The widget object

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

Inherited from WidgetBase

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

Parameters
Property Description
$configA
mixed
$configB
mixed
Returns
stdClass

The config object

inherited public methodExists (string $name) : bool

Inherited from WidgetBase

Checks if a method exists, extension equivalent of method_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited public orderAssets (array $assets) : array

Inherited from WidgetBase

Prioritize assets based on the given order.

Parameters
Property Description
$assets
array
Returns
array

inherited public propertyExists (string $name) : bool

Inherited from WidgetBase

Checks if a property exists, extension equivalent of property_exists()

Parameters
Property Description
$name
string
Returns
bool

inherited public resetSession () : void

Inherited from WidgetBase

Resets all session data related to this widget.

Returns
void

inherited protected addAsset (string $type, string $path, array $attributes) : void

Inherited from WidgetBase

Adds the provided asset to the internal asset collections

Parameters
Property Description
$type
string
$path
string
$attributes
array
Returns
void

inherited protected deferPurgedSaveAttributes (Winter\Storm\Database\Model $model, array $attributesToPurge) : void

Inherited from FormModelSaver

Removes an array of attributes from the model. If the model implements the Purgeable trait, this is preferred over the internal logic.

Parameters
Property Description
$model

Model to adjust.

$attributesToPurge
array

Attribute values to remove from the model.

Returns
void

inherited protected extendableAddLocalExtension (Closure $callback, $outerScope = null)

Inherited from WidgetBase

Adds local extensibility to the current instance.

This rebinds a given closure to the current instance, making it able to access protected and private methods. This makes any call using $this within the closure act on the extended class, not the class providing the extension.

An outer scope may be provided by providing a second parameter, which will then be passed through to the closure as its first parameter. If this is not given, the current instance will be provided as the first parameter.

Parameters
Property Description
$callback
Closure
$outerScope
mixed
Returns
mixed

inherited protected extendableIsAccessible (mixed $class, string $propertyName) : bool

Inherited from WidgetBase

Checks if a property is accessible, property equivalent of is_callable()

Parameters
Property Description
$class
mixed
$propertyName
string
Returns
bool

inherited protected extensionCallMethod (ReflectionClass $class, string $method, array $params)

Inherited from WidgetBase

Calls a method through reflection.

Parameters
Property Description
$class
ReflectionClass
$method
string
$params
array
Returns
mixed

inherited protected extensionExtractMethods (string $extensionName, object $extensionObject) : void

Inherited from WidgetBase

Extracts the available methods from a behavior and adds it to the list of callable methods.

Parameters
Property Description
$extensionName
string
$extensionObject
object
Returns
void

inherited protected extensionGetClassLoader () : Winter\Storm\Support\ClassLoader | null

Inherited from WidgetBase

Gets the class loader

Returns
Winter\Storm\Support\ClassLoader | null

inherited protected extensionGetParentClass ($instance = null) : ReflectionClass | false

Inherited from WidgetBase

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.

Parameters
Property Description
$instance
mixed
Returns
ReflectionClass | false

inherited protected extensionMethodExists (ReflectionClass $class, string $methodName) : bool

Inherited from WidgetBase

Determines if the given class reflection contains the given method.

Parameters
Property Description
$class
ReflectionClass
$methodName
string
Returns
bool

inherited protected extensionNormalizeClassName (string $name) : string

Inherited from WidgetBase

Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes

Parameters
Property Description
$name
string
Returns
string

inherited protected fillFromConfig (array $properties = null) : void

Inherited from WidgetBase

Transfers config values stored inside the $config property directly on to the root object properties. If no properties are defined all config will be transferred if it finds a matching property.

Parameters
Property Description
$properties
array
Returns
void

inherited protected getAssetEntryBuildPath (array $asset) : string

Inherited from WidgetBase

Internal helper, attaches a build code to an asset path

Parameters
Property Description
$asset
array
Returns
string

inherited protected getAssetScheme (string $asset) : string

Inherited from WidgetBase

Internal helper, get asset scheme

Parameters
Property Description
$asset
string
Returns
string

inherited protected getLocalPath (string | null $relativePath) : string

Inherited from WidgetBase
Parameters
Property Description
$relativePath
string | null
Returns
string

inherited protected getSession (string $key = null, string $default = null) : string

Inherited from WidgetBase

Retrieves a widget related key/value pair from session data.

Parameters
Property Description
$key
string

Unique key for the data store.

$default
string

A default value to use when value is not found.

Returns
string

inherited protected handleViewException (Throwable $e, integer $obLevel) : void

Inherited from WidgetBase

Handle a view exception.

Parameters
Property Description
$e
Throwable
$obLevel
integer
Returns
void

inherited protected makeSessionId () : string

Inherited from WidgetBase

Returns a unique session identifier for this widget and controller action.

Returns
string

inherited protected prepareModelsToSave (Winter\Storm\Database\Model $model, array $saveData) : array

Inherited from FormModelSaver

Takes a model and fills it with data from a multidimensional array.

If an attribute is found to be a relationship, that relationship is also filled.

$modelsToSave = $this->prepareModelsToSave($model, [...]);

foreach ($modelsToSave as $modelToSave) {
    $modelToSave->save();
}
Parameters
Property Description
$model

Model to fill.

$saveData
array

Attribute values to fill model.

Returns
array

The collection of models to save.

inherited protected putSession (string $key, mixed $value) : void

Inherited from WidgetBase

Saves a widget related key/value pair in to session data.

Parameters
Property Description
$key
string

Unique key for the data store.

$value
mixed

The value to store.

Returns
void

inherited protected removeDuplicates () : void

Inherited from WidgetBase

Removes duplicate assets from the entire collection.

Returns
void

inherited protected setModelAttributes (Winter\Storm\Database\Model $model, array $saveData) : void

Inherited from FormModelSaver

Sets a data collection to a model attributes, relations are also set.

Parameters
Property Description
$model

Model to fill.

$saveData
array

Attribute values to fill model.

Returns
void
Copyright © 2024 Winter CMS