FormController
        
        Adds features for working with backend forms. This behavior
will inject CRUD actions to the controller -- including create,
update and preview -- along with some relevant AJAX handlers.
    
    
 class Backend\Behaviors\FormController
extends Backend\Classes\ControllerBehaviorEach action supports a custom context code, allowing fields to be displayed or hidden on a contextual basis, as specified by the form field definitions or some other custom logic.
This behavior is implemented in the controller like so:
public $implement = [
    \Backend\Behaviors\FormController::class,
];
public $formConfig = 'config_form.yaml';
The $formConfig property makes reference to the form configuration
values as either a YAML file, located in the controller view directory,
or directly as a PHP array.
Extends
| Class | Description | 
|---|---|
| ControllerBehavior | Controller Behavior 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 | 
| ExtensionTrait | Extension trait | 
| 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  | 
| SessionMaker | Session Maker Trait | 
| ViewMaker | View Maker Trait Adds view based methods to a class | 
| WidgetMaker | Widget Maker Trait | 
Constants
| Constant | Type | Value | Description | 
|---|---|---|---|
| CONTEXT_CREATE | string | "create" | 
                                                            string
                                                         "create"Default context for "create" pages. | 
| CONTEXT_PREVIEW | string | "preview" | 
                                                            string
                                                         "preview"Default context for "preview" pages. | 
| CONTEXT_UPDATE | string | "update" | 
                                                            string
                                                         "update"Default context for "update" pages. | 
Properties
            
            
            
                public
            
            
            $formConfig
            
                :
                                                            mixed
                                                                        
                        = "config_form.yaml"
                    
                            
        
        
        Configuration for this behaviour
            
            
            
                protected
            
            
            $actions
            
                :
                                                            array
                                                                        
                        = ["create","update","preview"]
                    
                            
        
        
        Visible actions in context of the controller
protected $context : string
The context to pass to the form widget.
protected $controller : Backend\Classes\Controller | FormController
Reference to the back end controller.
protected $formWidget : Backend\Widgets\Form
Reference to the widget object.
protected $model : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model
The initialized model used by the form.
            
            
            
                protected
            
            
            $requiredConfig
            
                :
                                                            array
                                                                        
                        = ["modelClass","form"]
                    
                            
        
        
        Configuration values that must exist when applying the primary config file.
- modelClass: Class name for the model
- form: Form field definitions
inherited public $assetPath : string
Specifies a path to the asset directory.
            
                            
                    inherited
                
            
            
                public
            
                            
                    static
                
            
            $extendableStaticCalledClass
            
                :
                                                            string
                                                                        
                        = null
                    
                            
        
                    The calling class when using a static method.
inherited public $layout : string
Layout to use for the view.
            
                            
                    inherited
                
            
            
                public
            
            
            $suppressLayout
            
                :
                                                            bool
                                                                        
                        = false
                    
                            
        
                    Prevents the use of a layout.
            
                            
                    inherited
                
            
            
                public
            
            
            $vars
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    A list of variables to pass to the page.
            
                            
                    inherited
                
            
            
                protected
            
            
            $assets
            
                :
                                                            array
                                                                        
                        = {"js":[],"css":[],"rss":[],"vite":[]}
                    
                            
        
                    Collection of assets to display in the layout.
inherited protected $config : array
Supplied configuration.
inherited protected $configPath : string
Specifies a path to the config directory.
            
                            
                    inherited
                
            
            
                protected
            
                            
                    static
                
            
            $extensionCallbacks
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Used to extend the constructor of an extension class. Eg:
BehaviorClass::extend(function($obj) { })
            
                            
                    inherited
                
            
            
                protected
            
            
            $extensionHidden
            
                :
                                                            mixed
                                                                        
                        = {"fields":[],"methods":["extensionIsHiddenField","extensionIsHiddenMethod"]}
                    
                            
        
                    inherited protected $layoutPath : string
Specifies a path to the layout directory.
            
                            
                    inherited
                
            
            
                protected
            
            
            $modelsToSave
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    List of prepared models that require saving.
inherited protected $orderFactor : integer
Ensures "first-come, first-served" applies to assets of the same ordering.
            
                            
                    inherited
                
            
            
                protected
            
            
            $requiredProperties
            
                :
                                                            array
                                                                        
                        = []
                    
                            
        
                    Properties that must exist in the controller using this behavior.
inherited protected $viewPath : string | array
Specifies a path to the views directory.
Methods
public __construct (Backend\Classes\Controller $controller)
Behavior constructor
| Property | Type | Description | 
|---|---|---|
| $controller | Backend\Classes\Controller | 
            
            
            
                public
            
                        
            create (string $context = null)
                            : void
                    
        
        Controller "create" action used for creating new model records.
| Property | Type | Description | 
|---|---|---|
| $context | string | string Form context | 
            
            
            
                public
            
                        
            create_onSave (string $context = null)
                            : Illuminate\Http\RedirectResponse | void
                    
        
        AJAX handler "onSave" called from the create action and primarily used for creating new records.
This handler will invoke the unique controller overrides
formBeforeCreate and formAfterCreate.
| Property | Type | Description | 
|---|---|---|
| $context | string | string Form context | 
public static extendFormFields (callable $callback) : void
Static helper for extending form fields.
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable | 
public formAfterCreate ($model)
Called after the creation form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formAfterDelete ($model)
Called after the form model is deleted.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formAfterSave ($model)
Called after the creation or updating form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formAfterUpdate ($model)
Called after the updating form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formBeforeCreate ($model)
Called before the creation form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formBeforeSave ($model)
Called before the creation or updating form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formBeforeUpdate ($model)
Called before the updating form is saved.
| Property | Type | Description | 
|---|---|---|
| $model | mixed | mixed | 
public formCreateModelObject () : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model
Creates a new instance of a form model. This logic can be changed by overriding it in the controller.
public formExtendFields (Backend\Widgets\Form $host, array $fields) : void
Called after the form fields are defined.
| Property | Type | Description | 
|---|---|---|
| $host | Backend\Widgets\Form | The hosting form widget | 
| $fields | array | array Array of all defined form field objects (\Backend\Classes\FormField) | 
public formExtendFieldsBefore (Backend\Widgets\Form $host) : void
Called before the form fields are defined.
| Property | Type | Description | 
|---|---|---|
| $host | Backend\Widgets\Form | The hosting form widget | 
public formExtendModel (Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model $model) : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model | void
Extend supplied model used by create and update actions, the model can be altered by overriding it in the controller.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model | 
public formExtendQuery (Winter\Storm\Database\Builder | Winter\Storm\Halcyon\Builder $query) : void
Extend the query used for finding the form model. Extra conditions can be applied to the query, for example, $query->withTrashed();
| Property | Type | Description | 
|---|---|---|
| $query | Winter\Storm\Database\Builder | Winter\Storm\Halcyon\Builder | 
public formExtendRefreshData (Backend\Widgets\Form $host, array $saveData) : array | void
Called before the form is refreshed, should return an array of additional save data.
| Property | Type | Description | 
|---|---|---|
| $host | Backend\Widgets\Form | The hosting form widget | 
| $saveData | array | array Current save data | 
public formExtendRefreshFields (Backend\Widgets\Form $host, array $fields) : array | void
Called when the form is refreshed, giving the opportunity to modify the form fields.
| Property | Type | Description | 
|---|---|---|
| $host | Backend\Widgets\Form | The hosting form widget | 
| $fields | array | array Current form fields | 
public formExtendRefreshResults (Backend\Widgets\Form $host, array $result) : array | void
Called after the form is refreshed, should return an array of additional result parameters.
| Property | Type | Description | 
|---|---|---|
| $host | Backend\Widgets\Form | The hosting form widget | 
| $result | array | array Current result parameters. | 
public formFindModelObject (string $recordId) : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model
Finds a Model record by its primary identifier, used by update actions. This logic can be changed by overriding it in the controller.
| Property | Type | Description | 
|---|---|---|
| $recordId | string | string | 
public formGetContext () : string
Returns the active form context, either obtained from the postback
variable called form_context or detected from the configuration,
or routing parameters.
            
            
            
                public
            
                        
            formGetId (string $suffix = null)
                            : string
                    
        
        Returns a unique ID for the form widget used by this behavior.
This is useful for dealing with identifiers in the markup.
<div id="<?= $this->formGetId()">...</div>
A suffix may be used passed as the first argument to reuse the identifier in other areas.
<button id="<?= $this->formGetId('button')">...</button>
| Property | Type | Description | 
|---|---|---|
| $suffix | string | string | 
public formGetModel () : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model
Returns the model initialized by this form behavior.
The model will be provided by one of the page actions or AJAX
handlers via the initForm method.
            
            
            
                public
            
                        
            formGetRedirectUrl (string $context = null, Model $model = null)
                            : string
                    
        
        Returns a redirect URL from the config based on supplied context.
Otherwise the default redirect is used. Relative URLs are treated as backend URLs.
| Property | Type | Description | 
|---|---|---|
| $context | string | string Redirect context, eg: create, update, delete. | 
| $model | Model | Model The active model. | 
public formGetSessionKey () : string
Helper to get the form session key.
public formGetWidget () : Backend\Widgets\Form
public formHasOutsideFields () : bool
View helper to check if a form tab has fields in the non-tabbed section (outside fields).
formHasOutsideFields()): ?><!-- Do something -->
public formHasPrimaryTabs () : bool
View helper to check if a form tab has fields in the primary tab section.
formHasPrimaryTabs()): ?><!-- Do something -->
public formHasSecondaryTabs () : bool
View helper to check if a form tab has fields in the secondary tab section.
formHasSecondaryTabs()): ?><!-- Do something -->
            
            
            
                public
            
                        
            formRender (array $options = [])
                            : string
                    
        
        Method to render the prepared form markup. This method is usually called from a view file.
= $this->formRender() ?>The first argument supports an array of render options. The supported
options can be found via the render method of the Form widget class.
<?= $this->formRender(['preview' => true, section' => 'primary']) ?>
| Property | Type | Description | 
|---|---|---|
| $options | array | array Render options | 
Rendered HTML for the form.
            
            
            
                public
            
                        
            formRenderField (string $name, array $options = [])
                            : string
                    
        
        View helper to render a single form field.
= $this->formRenderField('field_name') ?>| Property | Type | Description | 
|---|---|---|
| $name | string | string Field name | 
| $options | array | array (e.g. ['useContainer'=>false]) | 
HTML markup
public formRenderOutsideFields () : string
View helper to render the form fields belonging to the non-tabbed section (outside form fields).
= $this->formRenderOutsideFields() ?>HTML markup
public formRenderPreview () : string
View helper to render the form in preview mode.
= $this->formRenderPreview() ?>The form HTML markup.
public formRenderPrimaryTabs () : string
View helper to render the form fields belonging to the primary tabs section.
= $this->formRenderPrimaryTabs() ?>HTML markup
public formRenderSecondaryTabs () : string
View helper to render the form fields belonging to the secondary tabs section.
= $this->formRenderSecondaryTabs() ?>HTML markup
            
            
            
                public
            
                        
            initForm (Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model $model, string $context = null)
                            : void
                    
        
        Initialize the form configuration against a model and context value.
This will process the configuration found in the $formConfig property
and prepare the Form widget, which is the underlying tool used for
actually rendering the form. The model used by this form is passed
to this behavior via this method as the first argument.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model | |
| $context | string | string Form context | 
            
            
            
                public
            
                        
            makeRedirect (string $context = null, Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model $model = null)
                            : Illuminate\Http\RedirectResponse
                    
        
        Returns a Redirect object based on supplied context and parses the model primary key.
| Property | Type | Description | 
|---|---|---|
| $context | string | string Redirect context, eg: create, update, delete | 
| $model | Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model | The active model to parse in it's ID and attributes. | 
            
            
            
                public
            
                        
            preview (int $recordId = null, string $context = null)
                            : void
                    
        
        Controller "preview" action used for viewing existing model records.
This action takes a record identifier (primary key of the model) to locate the record used for sourcing the existing preview data.
| Property | Type | Description | 
|---|---|---|
| $recordId | int | int Record identifier | 
| $context | string | string Form context | 
            
            
            
                public
            
                        
            update (int $recordId = null, string $context = null)
                            : void
                    
        
        Controller "update" action used for updating existing model records.
This action takes a record identifier (primary key of the model) to locate the record used for sourcing the existing form values.
| Property | Type | Description | 
|---|---|---|
| $recordId | int | int Record identifier | 
| $context | string | string Form context | 
            
            
            
                public
            
                        
            update_onDelete (int $recordId = null)
                            : Illuminate\Http\RedirectResponse | void
                    
        
        AJAX handler "onDelete" called from the update action and used for deleting existing records.
This handler will invoke the unique controller override
formAfterDelete.
| Property | Type | Description | 
|---|---|---|
| $recordId | int | int Record identifier | 
            
            
            
                public
            
                        
            update_onSave (int $recordId = null, string $context = null)
                            : Illuminate\Http\RedirectResponse | void
                    
        
        AJAX handler "onSave" called from the update action and primarily used for updating existing records.
This handler will invoke the unique controller overrides
formBeforeUpdate and formAfterUpdate.
| Property | Type | Description | 
|---|---|---|
| $recordId | int | int Record identifier | 
| $context | string | string Form context | 
protected createModel () : Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model
Internal method used to prepare the form model object.
            
            
            
                protected
            
                        
            getLang (string $name, string $default = null, array $extras = [])
                            : string
                    
        
        Parses in some default variables to a language string defined in config.
| Property | Type | Description | 
|---|---|---|
| $name | string | string Configuration property containing the language string | 
| $default | string | string A default language string to use if the config is not found | 
| $extras | array | array Any extra params to include in the language string variables | 
The translated string.
protected prepareVars (Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model $model)
Prepares commonly used view data.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Winter\Storm\Halcyon\Model | 
            
                            
                    inherited
                
            
            
                public
            
                        
            addCss (string | array $name, array $attributes = [])
                            : void
                    
                    Adds StyleSheet asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
| Property | Type | Description | 
|---|---|---|
| $name | string | array | string | array When an array of paths are provided they will be passed to the Asset Combiner | 
| $attributes | array | array When a string is provided it will be used as the 'build' attribute value | 
            
                            
                    inherited
                
            
            
                public
            
                        
            addJs (string | array $name, array $attributes = [])
                            : void
                    
                    Adds JavaScript asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
| Property | Type | Description | 
|---|---|---|
| $name | string | array | string | array When an array of paths are provided they will be passed to the Asset Combiner | 
| $attributes | array | array When a string is provided it will be used as the 'build' attribute value | 
            
                            
                    inherited
                
            
            
                public
            
                        
            addRss (string $name, array $attributes = [])
                            : void
                    
                    Adds an RSS link asset to the asset list. Call $this->makeAssets() in a view to output corresponding markup.
| Property | Type | Description | 
|---|---|---|
| $name | string | string | 
| $attributes | array | array | 
inherited public addViewPath (string | array $path) : void
Prepends a path on the available view path locations.
| Property | Type | Description | 
|---|---|---|
| $path | string | array | string | array | 
            
                            
                    inherited
                
            
            
                public
            
                        
            addVite (array | string $entrypoints, ?string $package = null)
                            : void
                    
                    Adds Vite tags
| Property | Type | Description | 
|---|---|---|
| $entrypoints | array | string | array | string The list of entry points for Vite | 
| $package | ?string | ?string The package name of the plugin or theme | 
            
                            
                    inherited
                
            
            
                public
            
                        
            combineAssets (array $assets, string $localPath = "")
                            : string
                    
                    Run the provided assets through the Asset Combiner
| Property | Type | Description | 
|---|---|---|
| $assets | array | array | 
| $localPath | string | string | 
inherited public static extend (callable $callback)
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable | 
inherited public extensionApplyInitCallbacks ()
inherited public static extensionExtendCallback (callable $callback) : void
Helper method for ::extend() static method
| Property | Type | Description | 
|---|---|---|
| $callback | callable | callable | 
inherited public extensionIsHiddenField ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited public extensionIsHiddenMethod ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited public flushAssets () : void
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.
            
                            
                    inherited
                
            
            
                public
            
                        
            getAssetPath (string $fileName, $assetPath = null)
                            : string
                    
                    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.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string | 
| $assetPath | mixed | mixed | 
inherited public getAssetPaths () : array
Returns an array of all registered asset paths.
Assets will be prioritized based on their defined ordering.
inherited public static getCalledExtensionClass ()
            
                            
                    inherited
                
            
            
                public
            
                        
            getConfig (string $name = null, mixed $default = null)
                            : string
                    
                    Safe accessor for configuration values.
| Property | Type | Description | 
|---|---|---|
| $name | string | string Config name, supports array names like "field[key]" | 
| $default | mixed | mixed Default value if nothing is found | 
            
                            
                    inherited
                
            
            
                public
            
                        
            getConfigPath (string $fileName, mixed $configPath = null)
                            : string
                    
                    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.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string File to load. | 
| $configPath | mixed | mixed Explicitly define a config path. | 
Full path to the config file.
            
                            
                    inherited
                
            
            
                public
            
                        
            getViewPath (string $fileName, $viewPaths = null)
                            : string
                    
                    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.
| Property | Type | Description | 
|---|---|---|
| $fileName | string | string | 
| $viewPaths | mixed | mixed | 
inherited public getViewPaths () : array
Returns the active view path locations.
            
                            
                    inherited
                
            
            
                public
            
                        
            guessConfigPath (string $suffix = "")
                            : string
                    
                    Guess the package path for the called class.
| Property | Type | Description | 
|---|---|---|
| $suffix | string | string An extra path to attach to the end | 
            
                            
                    inherited
                
            
            
                public
            
                        
            guessConfigPathFrom (string $class, string $suffix = "")
                            : string
                    
                    Guess the package path from a specified class.
| Property | Type | Description | 
|---|---|---|
| $class | string | string Class to guess path from. | 
| $suffix | string | string An extra path to attach to the end | 
            
                            
                    inherited
                
            
            
                public
            
                        
            guessViewPath (string $suffix = "", boolean $isPublic = false)
                            : string | null
                    
                    Guess the package path for the called class.
| Property | Type | Description | 
|---|---|---|
| $suffix | string | string An extra path to attach to the end | 
| $isPublic | boolean | boolean Returns public path instead of an absolute one | 
            
                            
                    inherited
                
            
            
                public
            
                        
            guessViewPathFrom (string $class, string $suffix = "", boolean $isPublic = false)
                            : string | null
                    
                    Guess the package path from a specified class.
| Property | Type | Description | 
|---|---|---|
| $class | string | string Class to guess path from. | 
| $suffix | string | string An extra path to attach to the end | 
| $isPublic | boolean | boolean Returns public path instead of an absolute one | 
inherited public hasAssetsDefined () : bool
Returns true if assets any have been added.
            
                            
                    inherited
                
            
            
                public
            
                        
            makeAssets ($type = null)
                            : string | null
                    
                    Outputs <link> and <script> tags to load assets previously added
with addJs, addCss, & addRss method calls depending on the provided $type
| Property | Type | Description | 
|---|---|---|
| $type | mixed | mixed | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makeConfig (array $configFile = [], array $requiredConfig = [])
                            : array | stdClass
                    
                    Reads the contents of the supplied file and applies it to this object.
| Property | Type | Description | 
|---|---|---|
| $configFile | array | array | 
| $requiredConfig | array | array | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makeConfigFromArray (array $configArray = [])
                            : stdClass
                    
                    Makes a config object from an array, making the first level keys properties of a new object.
| Property | Type | Description | 
|---|---|---|
| $configArray | array | array Config array. | 
The config object
            
                            
                    inherited
                
            
            
                public
            
                        
            makeFileContents (string $filePath, array $extraParams = [])
                            : string
                    
                    Makes all views in context of the controller, not the behavior.
| Property | Type | Description | 
|---|---|---|
| $filePath | string | string Absolute path to the view file. | 
| $extraParams | array | array Parameters that should be available to the view. | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makeFormWidget (string $class, array $fieldConfig = [], array $widgetConfig = [])
                            : Backend\Classes\FormWidgetBase
                    
                    Makes a form widget object with the supplied form field and widget configuration.
| Property | Type | Description | 
|---|---|---|
| $class | string | string Widget class name | 
| $fieldConfig | array | array A field name, an array of config or a FormField object. | 
| $widgetConfig | array | array An array of config. | 
The widget object
            
                            
                    inherited
                
            
            
                public
            
                        
            makeLayout ($name = null, array $params = [], boolean $throwException = true)
                            : string | bool
                    
                    Render a layout, defaulting to the layout propery specified on the class
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
| $params | array | array | 
| $throwException | boolean | boolean | 
The layout contents, or false.
            
                            
                    inherited
                
            
            
                public
            
                        
            makeLayoutPartial (string $partial, array $params = [])
                            : string
                    
                    Renders a layout partial
| Property | Type | Description | 
|---|---|---|
| $partial | string | string | 
| $params | array | array | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makePartial (string $partial, array $params = [], boolean $throwException = true)
                            : mixed
                    
                    Render a partial file contents located in the views folder.
| Property | Type | Description | 
|---|---|---|
| $partial | string | string | 
| $params | array | array | 
| $throwException | boolean | boolean | 
Partial contents or false if not throwing an exception.
inherited public makeView (string $view) : string
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
| Property | Type | Description | 
|---|---|---|
| $view | string | string | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makeViewContent (string $contents, $layout = null)
                            : string
                    
                    Renders supplied contents inside a layout.
| Property | Type | Description | 
|---|---|---|
| $contents | string | string | 
| $layout | mixed | mixed | 
            
                            
                    inherited
                
            
            
                public
            
                        
            makeWidget (string $class, array $widgetConfig = [])
                            : mixed | Backend\Classes\WidgetBase
                    
                    Makes a widget object with the supplied configuration file.
| Property | Type | Description | 
|---|---|---|
| $class | string | string Widget class name | 
| $widgetConfig | array | array An array of config. | 
The widget object
inherited public mergeConfig (mixed $configA, mixed $configB) : stdClass
Merges two configuration sources, either prepared or not, and returns them as a single configuration object.
| Property | Type | Description | 
|---|---|---|
| $configA | mixed | mixed | 
| $configB | mixed | mixed | 
The config object
inherited public orderAssets (array $assets) : array
Prioritize assets based on the given order.
| Property | Type | Description | 
|---|---|---|
| $assets | array | array | 
inherited public resetSession () : void
Resets all session data related to this widget.
            
                            
                    inherited
                
            
            
                public
            
                        
            setConfig (mixed $config, array $required = [])
                    
                    Sets the configuration values
| Property | Type | Description | 
|---|---|---|
| $config | mixed | mixed Config object or array | 
| $required | array | array Required config items | 
inherited protected addAsset (string $type, string $path, array $attributes) : void
Adds the provided asset to the internal asset collections
| Property | Type | Description | 
|---|---|---|
| $type | string | string | 
| $path | string | string | 
| $attributes | array | array | 
inherited protected controllerMethodExists (string $methodName) : bool
Returns true in case if a specified method exists in the extended controller.
| Property | Type | Description | 
|---|---|---|
| $methodName | string | string Specifies the method name | 
inherited protected deferPurgedSaveAttributes (Winter\Storm\Database\Model $model, array $attributesToPurge) : void
Removes an array of attributes from the model. If the model implements the Purgeable trait, this is preferred over the internal logic.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Model to adjust. | 
| $attributesToPurge | array | array Attribute values to remove from the model. | 
inherited protected extensionHideField ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited protected extensionHideMethod ($name)
| Property | Type | Description | 
|---|---|---|
| $name | mixed | mixed | 
inherited protected getAssetEntryBuildPath (array $asset) : string
Internal helper, attaches a build code to an asset path
| Property | Type | Description | 
|---|---|---|
| $asset | array | array | 
inherited protected getAssetScheme (string $asset) : string
Internal helper, get asset scheme
| Property | Type | Description | 
|---|---|---|
| $asset | string | string | 
inherited protected getLocalPath (string | null $relativePath) : string
| Property | Type | Description | 
|---|---|---|
| $relativePath | string | null | string | null | 
            
                            
                    inherited
                
            
            
                protected
            
                        
            getSession (string $key = null, string $default = null)
                            : string
                    
                    Retrieves a widget related key/value pair from session data.
| Property | Type | Description | 
|---|---|---|
| $key | string | string Unique key for the data store. | 
| $default | string | string A default value to use when value is not found. | 
inherited protected handleViewException (Throwable $e, integer $obLevel) : void
Handle a view exception.
| Property | Type | Description | 
|---|---|---|
| $e | Throwable | Throwable | 
| $obLevel | integer | integer | 
inherited protected hideAction (mixed $methodName)
Protects a public method from being available as an controller action.
These methods could be defined in a controller to override a behavior default action. Such methods should be defined as public, to allow the behavior object to access it. By default public methods of a controller are considered as actions. To prevent this occurrence, methods should be hidden by using this method.
| Property | Type | Description | 
|---|---|---|
| $methodName | mixed | mixed Specifies a method name. | 
inherited protected makeSessionId () : string
Returns a unique session identifier for this widget and controller action.
inherited protected prepareModelsToSave (Winter\Storm\Database\Model $model, array $saveData) : array
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();
}
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Model to fill. | 
| $saveData | array | array Attribute values to fill model. | 
The collection of models to save.
inherited protected putSession (string $key, mixed $value) : void
Saves a widget related key/value pair in to session data.
| Property | Type | Description | 
|---|---|---|
| $key | string | string Unique key for the data store. | 
| $value | mixed | mixed The value to store. | 
inherited protected removeDuplicates () : void
Removes duplicate assets from the entire collection.
inherited protected setModelAttributes (Winter\Storm\Database\Model $model, array $saveData) : void
Sets a data collection to a model attributes, relations are also set.
| Property | Type | Description | 
|---|---|---|
| $model | Winter\Storm\Database\Model | Model to fill. | 
| $saveData | array | array Attribute values to fill model. |