Lists
List Widget
Used for building back end lists, renders a list of model objects
class Backend\Widgets\Lists
extends Backend\Classes\WidgetBase
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 |
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. |
PreferenceMaker
|
Preference Maker Trait |
SessionMaker
|
Session Maker Trait |
ViewMaker
|
View Maker Trait Adds view based methods to a class |
WidgetMaker
|
Widget Maker Trait |
Properties
public $columns : array
List column configuration.
public
$cssClasses
:
array
= []
List of CSS classes to apply to the list container element
public $customViewPath : string
Specify a custom view path to override partials used by the list.
public $defaultSort : mixed
A default sort column to look for.
public $model : Model
List model object.
public
$noRecordsMessage
:
string
= "backend::lang.list.no_records"
Message to display when there are no records in the list.
public $perPageOptions : array
Options for number of items per page.
public $recordOnClick : string
Click event for each record row. Replace :id with the record id.
public $recordUrl : string
Link for each record row. Replace :id with the record id.
public $recordsPerPage : int
Maximum rows to display for each page.
public
$showCheckboxes
:
bool
= false
Display a checkbox next to each record row.
public
$showPageNumbers
:
bool
= true
Display page numbers with pagination, disable to improve performance.
public
$showPagination
:
bool
|
string
= "auto"
Display pagination when limiting records per page.
public
$showSetup
:
bool
= false
Display the list set up used for column visibility and ordering.
public
$showSorting
:
bool
= true
Shows the sorting options for each column.
public
$showTree
:
bool
= false
Display parent/child relationships in the list.
public
$treeExpanded
:
bool
= false
Expand the tree nodes by default.
protected $allColumns : array
Collection of all list columns used in this list.
protected $columnOverride : array
Override default columns with supplied key names.
protected $currentPageNumber : int
Current page number.
protected
$defaultAlias
:
mixed
= "list"
A unique alias to identify this widget.
protected
$filterCallbacks
:
array
= []
Collection of functions to apply to each list query.
protected $records : array
Model data collection.
protected $searchMode : string
If searching the records, specifies a policy to use.
- all: result must contain all words
- any: result can contain any word
- exact: result must contain the exact phrase
protected $searchScope : string
Use a custom scope method for performing searches.
protected $searchTerm : string
Filter the records by a search term.
protected $sortColumn : string
Sets the list sorting column.
protected $sortDirection : string
Sets the list sorting direction (asc, desc)
protected $sortableColumns : array
All sortable columns.
protected $visibleColumns : array
Columns to display and their order.
public $alias : string
Defined alias used for this widget.
public $assetPath : string
Specifies a path to the asset directory.
public $config : object
Supplied configuration.
public
$implement
:
string
|
array
|
null
= null
Extensions implemented by this class.
public $layout : string
Layout to use for the view.
public
$suppressLayout
:
bool
= false
Prevents the use of a layout.
public
$vars
:
array
= []
A list of variables to pass to the page.
protected
$assets
:
array
= {"js":[],"css":[],"rss":[]}
Collection of assets to display in the layout.
protected $configPath : string
Specifies a path to the config directory.
protected $controller : Backend\Classes\Controller
Backend controller object.
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
$extendableGuardProperties
:
bool
= true
Indicates if dynamic properties can be created.
protected
static
$extendableStaticMethods
:
array
= []
Collection of static methods used by behaviors.
protected
$extensionData
:
array
= {"extensions":[],"methods":[],"dynamicMethods":[],"dynamicProperties":[]}
Class reflection information, including behaviors.
protected $fatalError : string
Object used for storing a fatal error.
protected $layoutPath : string
Specifies a path to the layout directory.
protected
static
$preferenceCache
:
array
= []
Cache for retrieved user preferences.
protected $viewPath : string | array
Specifies a path to the views directory.
Methods
public addColumns (array $columns)
Programatically add columns, used internally and for extensibility.
Property | Type | Description |
---|---|---|
$columns | array |
array
Column definitions |
public addFilter (callable $filter)
Property | Type | Description |
---|---|---|
$filter | callable |
callable
|
public getColumn (string $column) : mixed
Get a specified column object
Property | Type | Description |
---|---|---|
$column | string |
string
|
public getColumnValue ($record, $column) : string
Returns a column value, with filters applied
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
public getColumnValueRaw ($record, $column) : string
Returns a raw column value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
public getColumns () : array
Get all the registered columns for the instance.
public getHeaderValue ($column)
Looks up the column header
Property | Type | Description |
---|---|---|
$column | mixed |
mixed
|
public getRecordOnClick (Model $record) : string
Returns the onclick event for a list row.
public getRecordUrl (Model $record) : string
Returns the record URL address for a list row.
public getRowClass (Model $record) : string
Adds a custom CSS class string to a record row
public getSortColumn ()
Returns the current sorting column, saved in a session or cached.
public getSortDirection ()
public getVisibleColumns ()
Returns the list columns that are visible by list settings or default
public init ()
Initialize the widget, called by the constructor and free from its parameters.
public isTreeNodeExpanded (Model $node) : bool
Checks if a node (model) is expanded in the session.
public onApplySetup ()
Event handler to apply the list set up.
public onFilter ()
Event handler for changing the filter
public onLoadSetup ()
Event handler to display the list set up.
public onPaginate ()
Event handler for switching the page number.
public onRefresh ()
Event handler for refreshing the list.
public onResetSetup ()
Event handler to apply the list set up.
public onSort ()
Event handler for sorting the list.
public onToggleTreeNode () : string
Sets a node (model) to an expanded or collapsed state, stored in the session, then renders the list again.
List HTML contents.
public prepareModel ()
public prepareQuery ()
Applies any filters to the model.
public prepareVars ()
Prepares the list data
public removeColumn ($columnName)
Programatically remove a column, used for extensibility.
Property | Type | Description |
---|---|---|
$columnName | mixed |
mixed
|
public render ()
Renders the widget.
public
setSearchOptions (array $options = []
)
Applies a search options to the list search.
Property | Type | Description |
---|---|---|
$options | array |
array
|
public
setSearchTerm (string $term, boolean $resetPagination = false
)
Applies a search term to the list results, searching will disable tree view if a value is supplied.
Property | Type | Description |
---|---|---|
$term | string |
string
|
$resetPagination | boolean |
boolean
|
public validateTree () : void
Validates the model and settings if showTree is used
protected
applySearchToQuery ($query, $columns, string $boolean = "and"
)
Applies the search constraint to a query.
Property | Type | Description |
---|---|---|
$query | mixed |
mixed
|
$columns | mixed |
mixed
|
$boolean | string |
string
|
protected defineListColumns ()
Builds an array of list columns with keys as the column name and values as a ListColumn object.
protected evalColorPickerTypeValue ($record, $column, $value)
Process as background color, to be seen at list
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalCustomListType ($type, $record, $column, $value)
Process a custom list types registered by plugins.
Property | Type | Description |
---|---|---|
$type | mixed |
mixed
|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalDateTypeValue ($record, $column, $value)
Process as a date value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalDatetimeTypeValue ($record, $column, $value)
Process as a datetime value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalImageTypeValue ($record, $column, $value) : string
Process an image value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalNumberTypeValue ($record, $column, $value) : string
Process as number, proxy to text
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalPartialTypeValue ($record, $column, $value)
Process as partial reference
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalSwitchTypeValue ($record, $column, $value)
Process as boolean switch
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalTextTypeValue ($record, $column, $value) : string
Process as text, escape the value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalTimeTypeValue ($record, $column, $value)
Process as a time value
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalTimesinceTypeValue ($record, $column, $value)
Process as diff for humans (1 min ago)
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected evalTimetenseTypeValue ($record, $column, $value)
Process as time as current tense (Today at 0:00)
Property | Type | Description |
---|---|---|
$record | mixed |
mixed
|
$column | mixed |
mixed
|
$value | mixed |
mixed
|
protected getCurrentPageNumber (object $query) : int
Returns the current page number for the list.
This will override the current page number provided by the user if it is past the last page of available records.
Property | Type | Description |
---|---|---|
$query | object |
object
|
protected getRecords () : Collection
Returns all the records from the supplied model, after filtering.
protected getSearchableColumns () : array
Returns a collection of columns which can be searched.
protected getSetupListColumns ()
Returns all the list columns used for list set up.
protected getSetupPerPageOptions ()
Returns an array of allowable records per page.
protected getSortableColumns ()
Returns a collection of columns which are sortable.
protected getTotalColumns ()
Calculates the total columns used in the list, including checkboxes and other additions.
protected isColumnPivot (ListColumn $column) : bool
Checks if a column refers to a pivot model specifically.
Property | Type | Description |
---|---|---|
$column | ListColumn |
List column object |
protected
isColumnRelated (Backend\Classes\ListColumn $column, boolean $multi = false
)
: bool
Check if column refers to a relation of the model
Property | Type | Description |
---|---|---|
$column | Backend\Classes\ListColumn |
Backend\Classes\ListColumn
|
$multi | boolean |
boolean
If set, returns true only if the relation is a "multiple relation type" |
protected
isSortable ($column = null
)
Returns true if the column can be sorted.
Property | Type | Description |
---|---|---|
$column | mixed |
mixed
|
protected loadAssets ()
Adds widget specific asset files. Use $this->addJs() and $this->addCss() to register new assets to include on the page.
protected makeListColumn ($name, $config)
Creates a list column object from it's name and configuration.
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$config | mixed |
mixed
|
protected parseTableName (string $sql, string $table) : string
Replaces the @ symbol with a table name in a model
Property | Type | Description |
---|---|---|
$sql | string |
string
|
$table | string |
string
|
protected validateDateTimeValue ($value, $column)
Validates a column type as a date
Property | Type | Description |
---|---|---|
$value | mixed |
mixed
|
$column | mixed |
mixed
|
protected validateModel () : void
Validate the supplied form model.
public __call ($name, $params)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | mixed |
mixed
|
public static __callStatic ($name, $params)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | mixed |
mixed
|
public
__construct (Backend\Classes\Controller $controller, array $configuration = []
)
Constructor
Property | Type | Description |
---|---|---|
$controller | Backend\Classes\Controller | |
$configuration | array |
array
Proactive configuration definition. |
public __get ($name)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
public __set ($name, $value)
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$value | mixed |
mixed
|
public
addCss (array | string $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 | array | string |
array | string
Specifies a path (URL) or an array of paths to the stylesheet(s). |
$attributes | array |
array
Adds extra HTML attributes to the asset link. |
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
addJs (array | string $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 | array | string |
array | string
Specifies a path (URL) or an array of paths to the script(s). |
$attributes | array |
array
Adds extra HTML attributes to the asset link. |
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
Specifies a path (URL) to the RSS channel |
$attributes | array |
array
Adds extra HTML attributes to the asset link. |
public addViewPath (string | array $path) : void
Prepends a path on the available view path locations.
Property | Type | Description |
---|---|---|
$path | string | array |
string | array
|
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 bindToController () : void
Binds a widget to the controller for safe use.
public static clearExtendedClasses () : void
Clear the list of extended classes so they will be re-extended.
public clearUserPreference (string $key) : void
Clears a single preference key from the user preferences for this controller/widget.
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
public clearUserPreferences () : void
Clears all user preferences for this controller/widget.
public
combineAssets (array $assets, string $localPath = ""
)
: string
Run the provided assets through the Asset Combiner
Property | Type | Description |
---|---|---|
$assets | array |
array
Collection of assets |
$localPath | string |
string
Prefix all assets with this path (optional) |
public extendClassWith (string $extensionName) : void
Dynamically extend a class with a specified behavior
Property | Type | Description |
---|---|---|
$extensionName | string |
string
|
public
static
extendableAddExtension (callable $callback, boolean $scoped = false
, $outerScope = null
)
: void
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.
Property | Type | Description |
---|---|---|
$callback | callable |
callable
|
$scoped | boolean |
boolean
|
$outerScope | mixed |
mixed
|
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
fireSystemEvent (string $event, array $params = []
, boolean $halt = true
)
: mixed
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);
Property | Type | Description |
---|---|---|
$event | string |
string
Event name |
$params | array |
array
Event parameters |
$halt | boolean |
boolean
Halt after first non-null result |
public
fireViewEvent (string $event, array $params = []
)
: string
Special event function used for extending within view files, allowing HTML to be injected multiple times.
For example:
= $this->fireViewEvent('backend.auth.extendSigninView') ?>Property | Type | Description |
---|---|---|
$event | string |
string
Event name |
$params | array |
array
Event parameters |
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.
public
getAssetPath (string $fileName, string $assetPath = null
)
: string
Locates a file based on it's definition. If the file starts with a forward slash, it will be returned in context of the application public path, otherwise it will be returned in context of the asset path.
Property | Type | Description |
---|---|---|
$fileName | string |
string
File to load. |
$assetPath | string |
string
Explicitly define an asset path. |
Relative path to the asset file.
public getAssetPaths () : array
Returns an array of all registered asset paths.
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
getConfig (string $name, string $default = null
)
: string
Safe accessor for configuration values.
Property | Type | Description |
---|---|---|
$name | string |
string
Config name, supports array names like "field[key]" |
$default | string |
string
Default value if nothing is found |
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.
public getController ()
Returns the controller using this widget.
public getDynamicProperties () : array
Returns all dynamic properties and their values
['property' => 'value']
public getEventHandler (string $name) : string
Returns a fully qualified event handler name for this widget.
Property | Type | Description |
---|---|---|
$name | string |
string
The ajax event handler name. |
public getFatalError () : string
The fatal error message
public
getId (string $suffix = null
)
: string
Returns a unique ID for this widget. Useful in creating HTML markup.
Property | Type | Description |
---|---|---|
$suffix | string |
string
An extra string to append to the ID. |
A unique identifier.
public
getUserPreference (string $key = null
, mixed $default = null
)
: mixed
Retrieves a widget related key/value pair from the user preferences
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
$default | mixed |
mixed
A default value to use when value is not found. |
public getUserPreferences () : array
Retrieves and caches all user preferences for this particular controller/widget.
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
|
public getViewPaths () : array
Returns the active view path locations.
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 |
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 |
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 |
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 |
public handleError ($exception)
Sets standard page variables in the case of a controller error.
Property | Type | Description |
---|---|---|
$exception | mixed |
mixed
|
public hasAssetsDefined () : bool
Returns true if assets any have been added.
public hasFatalError () : bool
Whether a fatal error has been set or not.
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
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
|
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
|
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
public
makeFileContents (string $filePath, array $extraParams = []
)
: string
Includes a file path using output buffering, making the provided vars available.
Property | Type | Description |
---|---|---|
$filePath | string |
string
|
$extraParams | array |
array
|
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
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.
public
makeLayoutPartial (string $partial, array $params = []
)
: string
Renders a layout partial
Property | Type | Description |
---|---|---|
$partial | string |
string
|
$params | array |
array
|
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.
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
|
public
makeViewContent (string $contents, $layout = null
)
: string
Renders supplied contents inside a layout.
Property | Type | Description |
---|---|---|
$contents | string |
string
|
$layout | mixed |
mixed
|
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
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
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
|
public putUserPreference (string $key, mixed $value) : void
Saves a widget related key/value pair in to the users preferences
Property | Type | Description |
---|---|---|
$key | string |
string
Unique key for the data store. |
$value | mixed |
mixed
The value to store. |
public resetSession () : void
Resets all session data related to this widget.
protected addAsset (string $type, string $path, array $attributes)
Adds the provided asset to the internal asset collections
Property | Type | Description |
---|---|---|
$type | string |
string
The type of the asset: 'js' || 'css' || 'rss' |
$path | string |
string
The path to the asset |
$attributes | array |
array
The attributes for the asset |
protected
extendableAddLocalExtension (Closure $callback, $outerScope = null
)
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.
Property | Type | Description |
---|---|---|
$callback | Closure |
Closure
|
$outerScope | mixed |
mixed
|
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 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 extensionNormalizeClassName (string $name) : string
Normalizes the provided extension name allowing for the ClassLoader to inject aliased classes
Property | Type | Description |
---|---|---|
$name | string |
string
|
protected
fillFromConfig (array $properties = null
)
: void
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.
Property | Type | Description |
---|---|---|
$properties | array |
array
|
protected getAssetEntryBuildPath (array $asset) : string
Internal helper, attaches a build code to an asset path
Property | Type | Description |
---|---|---|
$asset | array |
array
Stored asset array |
protected getAssetScheme (string $asset) : string
Internal helper, get asset scheme
Property | Type | Description |
---|---|---|
$asset | string |
string
Specifies a path (URL) to the asset. |
protected getLocalPath (string | null $relativePath)
Property | Type | Description |
---|---|---|
$relativePath | string | null |
string | null
|
protected getPreferenceKey () : string
Returns a unique identifier for this widget and controller action for preference storage.
protected getPreferenceStorage () : Winter\Storm\Database\Model
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. |
protected handleViewException (Throwable $e, integer $obLevel) : void
Handle a view exception.
Property | Type | Description |
---|---|---|
$e | Throwable |
Throwable
|
$obLevel | integer |
integer
|
protected makeSessionId () : string
Returns a unique session identifier for this widget and controller action.
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. |
protected removeDuplicates () : void
Removes duplicate assets from the entire collection.