class Form extends BaseWidget

Traits

Form Model Widget Trait

Widget Maker Trait Class

Adds event related features to any class.

Extendable Trait Allows for "Private traits"

Properties

protected array $extensionData from  ExtendableTrait
static protected array $extendableCallbacks from  ExtendableTrait
static protected array $extendableStaticMethods from  ExtendableTrait
static protected bool $extendableGuardProperties from  ExtendableTrait
static protected ClassLoader $extendableClassLoader from  ExtendableTrait
$implement from  Extendable
array $vars from  ViewMaker
array $viewPath from  ViewMaker
array $layoutPath from  ViewMaker
array $partialPath from  ViewMaker
string $layout from  ViewMaker
bool $suppressLayout from  ViewMaker
protected $viewFileExtension from  ViewMaker
array $assetPath from  AssetMaker
string $configPath from  ConfigMaker
protected $configFileExtension from  ConfigMaker
protected array $emitterSingleEvents from  EventEmitter
protected array $emitterEvents from  EventEmitter
protected array $emitterEventSorted from  EventEmitter
protected AdminController $controller from  BaseWidget
object $config from  BaseWidget
string $alias from  BaseWidget
protected $defaultAlias
protected $modelsToSave from  FormModelWidget
array $fields
array $tabs
array $secondaryTabs
string $activeTab
Model $model
array $data
string $context
string $arrayName
protected bool $fieldsDefined
protected array $allFields
protected object $allTabs
protected array $formWidgets
string $sessionKey
bool $previewMode
protected Widgets $widgetManager
protected $optionModelTypes

Methods

extendableConstruct()

Constructor.

static void
extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

static void
clearExtendedClasses()

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

string
extensionNormalizeClassName(string $name)

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

extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

void
extensionExtractMethods(string $extensionName, object $extensionObject)

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

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

Programmatically adds a method to the extendable class

addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

bool
isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

mixed
getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

mixed
asExtension(string $shortName)

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

bool
methodExists(string $name)

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

array
getClassMethods()

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

array
getDynamicProperties()

Returns all dynamic properties and their values

bool
propertyExists(string $name)

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

bool
extendableIsAccessible(mixed $class, string $propertyName)

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

string
extendableGet(string $name)

Magic method for __get()

string
extendableSet(string $name, string $value)

Magic method for __set()

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

Magic method for __call()

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

Magic method for __callStatic()

ClassLoader|null
extensionGetClassLoader()

Gets the class loader

__construct(Controller $controller, array $config = [])

Constructor

__get($name)

No description

__set($name, $value)

No description

__call($name, $params)

No description

static 
__callStatic($name, $params)

No description

static 
extend(callable $callback)

No description

makeWidget(string $class, array $widgetConfig = [])

Makes a widget object with the supplied configuration ex. model config

makeFormWidget(string $class, mixed $fieldConfig = [], array $widgetConfig = [])

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

mixed
getSession(string $key = null, string $default = null)

Retrieves key/value pair from session data.

void
putSession(string $key, mixed $value)

Saves key/value pair in to session data.

hasSession($key)

No description

mixed
getTempSession(string $key = null, string $default = null)

Retrieves key/value pair from session temporary data.

void
putTempSession(string $key, mixed $value)

Saves key/value pair in to session temporary data.

forgetSession($key)

No description

resetSession()

No description

string
makeSessionKey()

Returns a unique session identifier for this location.

encodeSessionData($data)

No description

decodeSessionData($data)

No description

getViewPath($view, $viewPath = null)

No description

guessViewFileExtension($path)

No description

string
guessViewPath(string $suffix = '', bool $isPublic = false)

Guess the package path from a specified class.

mixed
makeLayout(string $name = null, array $vars = [], bool $throwException = true)

Render a layout.

string
makeView(string $view)

Loads a view with the name specified.

mixed
makePartial(string $partial, array $vars = [], bool $throwException = true)

Render a partial file contents located in the views or partial folder.

string
makeFileContent(string $filePath, array $extraParams = [])

Includes a file path using output buffering.

compileFileContent($filePath)

No description

void
handleViewException(Exception $e, int $obLevel)

Handle a view exception.

array
gatherViewData($data)

Get the data bound to the view instance.

flushAssets()

No description

string
getAssetPath(string $fileName, string $assetPath = null)

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.

addMeta($meta)

No description

addJs($href, $attributes = null)

No description

addCss($href, $attributes = null)

No description

array
loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)

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

array
makeConfig(string|array $configFile, array $requiredConfig = [])

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

array
mergeConfig($configLeft, $configRight)

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

string
getConfigPath(string $fileName, mixed $configPath = null)

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.

string
guessConfigPath(string $suffix = '')

Guess the package path for the called class.

string
guessConfigPathFrom(string $class, string $suffix = '')

Guess the package path from a specified class.

bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

void
emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

unbindEvent(string $event = null)

Destroys an event binding.

string|array
fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

mixed
fireSystemEvent(string $event, array $params = [], bool $halt = true)

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.

isLocationAware($config)

No description

locationApplyScope($query)

Apply location scope where required

void
initialize()

Initialize the widget called by the constructor.

string
render(array $options = [])

Renders the widget.

void
bindToController()

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.

void
fillFromConfig(array $properties = null)

Transfers config values stored inside the $config property directly on to the root object properties.

string
getId(string $suffix = null)

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

string
getEventHandler(string $name)

Returns a fully qualified event handler name for this widget.

getController()

Returns the controller using this widget.

setConfig(array $config, array $required = [])

Sets the widget configuration values

mixed
getConfig(string $name = null, mixed $default = null)

Get the widget configuration values.

void
loadAssets()

Adds widget specific asset files.

createFormModel()

No description

findFormModel($recordId)

No description

array
resolveModelAttribute(string $attribute = null)

Returns the final model and attribute name of a nested HTML array attribute.

getRelationModel()

Returns the model of a relation type.

getRelationObject()

No description

getRelationType()

No description

prepareModelsToSave($model, $saveData)

No description

void
setModelAttributes(Model $model, array $saveData)

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

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

Renders a single form field Options:

  • useContainer: Wrap the result in a container, used by AJAX. Default: true

string|bool
renderFieldElement(BaseFormWidget $field)

Renders the HTML element for a field

void
prepareVars()

Prepares the form data

array
setFormValues(array $data = null)

Sets or resets form field values.

array
onRefresh()

Event handler for refreshing the form.

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

Programmatically add fields, used internally and for extensibility.

void
addTabFields(array $fields)

Add tab fields.

bool
removeField(string $name)

Programmatically remove a field.

removeTab(string $name)

Programmatically remove all fields belonging to a tab.

makeFormField(string $name, array $config)

Creates a form field object from name and configuration.

makeFormFieldWidget(FormField $field)

Makes a widget object from a form field object.

array
getFormWidgets()

Get all the loaded form widgets for the instance.

mixed
getFormWidget(string $field)

Get a specified form widget

array
getFields()

Get all the registered fields for the instance.

mixed
getField(string $field)

Get a specified field object

getTabs()

Get all tab objects for the instance.

mixed
getTab(string $tab)

Get a specified tab object.

array
getFieldName(string $field)

Parses a field's name

string
getFieldValue(mixed $field)

Looks up the field value.

string
getFieldDepends(FormField $field)

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

bool
showFieldLabels(FormField $field)

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

array
getSaveData()

Returns post data from a submitted form.

setActiveTab($tab)

No description

getActiveTab()

No description

getCookieKey()

No description

Route|mixed|string
getSessionKey()

Returns the active session key.

string
getContext()

Returns the active context for displaying the form.

mixed
validateModel()

Validate the supplied form model.

void
defineFormFields()

Creates a flat array of form fields from the configuration.

void
processAutoSpan($fields)

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

bool
isFormWidget(string $fieldType)

Check if a field type is a widget or not

applyFiltersFromModel()

Allow the model to filter fields.

mixed
getOptionsFromModel(FormField $field, $fieldOptions)

Looks at the model for defined options.

bool
objectMethodExists(object $object, string $method)

Internal helper for method existence checks.

array|string
dataArrayGet(array $array, array $parts, null $default = null)

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

array|string
dataArraySet(array $array, array $parts, string $value)

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

getSourceData()

No description

Details

in ExtendableTrait at line 55
extendableConstruct()

Constructor.

in ExtendableTrait at line 103
static void extendableExtendCallback(callable $callback)

Helper method for ::extend() static method

Parameters

callable $callback

Return Value

void

in ExtendableTrait at line 120
static void clearExtendedClasses()

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

Return Value

void

in ExtendableTrait at line 131
protected string extensionNormalizeClassName(string $name)

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

Parameters

string $name

Return Value

string

in ExtendableTrait at line 149
void|ExtendableTrait extendClassWith(string $extensionName)

Dynamically extend a class with a specified behavior

Parameters

string $extensionName

Return Value

void|ExtendableTrait

Exceptions

Exception

in ExtendableTrait at line 178
protected void extensionExtractMethods(string $extensionName, object $extensionObject)

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

Parameters

string $extensionName
object $extensionObject

Return Value

void

in ExtendableTrait at line 206
addDynamicMethod(string $dynamicName, callable $method, string $extension = null)

Programmatically adds a method to the extendable class

Parameters

string $dynamicName
callable $method
string $extension

in ExtendableTrait at line 225
addDynamicProperty(string $dynamicName, string $value = null)

Programatically adds a property to the extendable class

Parameters

string $dynamicName
string $value

in ExtendableTrait at line 249
bool isClassExtendedWith(string $name)

Check if extendable class is extended with a behavior object

Parameters

string $name

Fully qualified behavior name

Return Value

bool

in ExtendableTrait at line 265
mixed getClassExtension(string $name)

Returns a behavior object from an extendable class, example:

$this->getClassExtension('Admin.Actions.FormController')

Parameters

string $name

Fully qualified behavior name

Return Value

mixed

in ExtendableTrait at line 280
mixed asExtension(string $shortName)

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

$this->asExtension('FormController')

Parameters

string $shortName

Return Value

mixed

in ExtendableTrait at line 301
bool methodExists(string $name)

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

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 313
array getClassMethods()

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

Return Value

array

in ExtendableTrait at line 326
array getDynamicProperties()

Returns all dynamic properties and their values

Return Value

array

['property' => 'value']

in ExtendableTrait at line 344
bool propertyExists(string $name)

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

Parameters

string $name

Return Value

bool

in ExtendableTrait at line 370
protected bool extendableIsAccessible(mixed $class, string $propertyName)

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

Parameters

mixed $class
string $propertyName

Return Value

bool

in ExtendableTrait at line 385
string extendableGet(string $name)

Magic method for __get()

Parameters

string $name

Return Value

string

in ExtendableTrait at line 410
string extendableSet(string $name, string $value)

Magic method for __set()

Parameters

string $name
string $value

Return Value

string

in ExtendableTrait at line 444
mixed extendableCall(string $name, array $params = null)

Magic method for __call()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 483
static mixed extendableCallStatic(string $name, array $params = null)

Magic method for __callStatic()

Parameters

string $name
array $params

Return Value

mixed

in ExtendableTrait at line 552
protected ClassLoader|null extensionGetClassLoader()

Gets the class loader

Return Value

ClassLoader|null

in BaseWidget at line 54
__construct(Controller $controller, array $config = [])

Constructor

Parameters

Controller $controller
array $config

in Extendable at line 30
__get($name)

No description

Parameters

$name

in Extendable at line 35
__set($name, $value)

No description

Parameters

$name
$value

in Extendable at line 40
__call($name, $params)

No description

Parameters

$name
$params

in Extendable at line 45
static __callStatic($name, $params)

No description

Parameters

$name
$params

in Extendable at line 50
static extend(callable $callback)

No description

Parameters

callable $callback

in WidgetMaker at line 24
BaseWidget makeWidget(string $class, array $widgetConfig = [])

Makes a widget object with the supplied configuration ex. model config

Parameters

string $class

Widget class name

array $widgetConfig

An array of config.

Return Value

BaseWidget

The widget object

in WidgetMaker at line 47
BaseFormWidget makeFormWidget(string $class, mixed $fieldConfig = [], array $widgetConfig = [])

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

Parameters

string $class

Widget class name

mixed $fieldConfig

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

array $widgetConfig

An array of config.

Return Value

BaseFormWidget

The widget object

Exceptions

Exception

in SessionMaker at line 17
mixed getSession(string $key = null, string $default = null)

Retrieves key/value pair from session data.

Parameters

string $key

Unique key for the data store.

string $default

A default value to use when value is not found.

Return Value

mixed

in SessionMaker at line 37
void putSession(string $key, mixed $value)

Saves key/value pair in to session data.

Parameters

string $key

Unique key for the data store.

mixed $value

The value to store.

Return Value

void

in SessionMaker at line 47
hasSession($key)

No description

Parameters

$key

in SessionMaker at line 62
mixed getTempSession(string $key = null, string $default = null)

Retrieves key/value pair from session temporary data.

Parameters

string $key

Unique key for the data store.

string $default

A default value to use when value is not found.

Return Value

mixed

in SessionMaker at line 82
void putTempSession(string $key, mixed $value)

Saves key/value pair in to session temporary data.

Parameters

string $key

Unique key for the data store.

mixed $value

The value to store.

Return Value

void

in SessionMaker at line 92
forgetSession($key)

No description

Parameters

$key

in SessionMaker at line 101
resetSession()

No description

in SessionMaker at line 111
protected string makeSessionKey()

Returns a unique session identifier for this location.

Return Value

string

in SessionMaker at line 119
protected encodeSessionData($data)

No description

Parameters

$data

in SessionMaker at line 130
protected decodeSessionData($data)

No description

Parameters

$data

in ViewMaker at line 50
getViewPath($view, $viewPath = null)

No description

Parameters

$view
$viewPath

in ViewMaker at line 78
guessViewFileExtension($path)

No description

Parameters

$path

in ViewMaker at line 98
string guessViewPath(string $suffix = '', bool $isPublic = false)

Guess the package path from a specified class.

Parameters

string $suffix

An extra path to attach to the end

bool $isPublic

Return Value

string

in ViewMaker at line 119
mixed makeLayout(string $name = null, array $vars = [], bool $throwException = true)

Render a layout.

Parameters

string $name

Specifies the layout name. If this parameter is omitted, the $layout property will be used.

array $vars

Parameter variables to pass to the view.

bool $throwException

Throw an exception if the layout is not found

Return Value

mixed

The layout contents, or false.

Exceptions

SystemException

in ViewMaker at line 147
string makeView(string $view)

Loads a view with the name specified.

Applies layout if its name is provided by the parent object. The view file must be situated in the views directory, and has the extension "htm" or "php".

Parameters

string $view

Specifies the view name, without extension. Eg: "index".

Return Value

string

in ViewMaker at line 171
mixed makePartial(string $partial, array $vars = [], bool $throwException = true)

Render a partial file contents located in the views or partial folder.

Parameters

string $partial

The view to load.

array $vars

Parameter variables to pass to the view.

bool $throwException

Throw an exception if the partial is not found.

Return Value

mixed

Partial contents or false if not throwing an exception.

Exceptions

SystemException

in ViewMaker at line 199
string makeFileContent(string $filePath, array $extraParams = [])

Includes a file path using output buffering.

Ensures that vars are available.

Parameters

string $filePath

Absolute path to the view file.

array $extraParams

Parameters that should be available to the view.

Return Value

string

in ViewMaker at line 235
compileFileContent($filePath)

No description

Parameters

$filePath

in ViewMaker at line 256
protected void handleViewException(Exception $e, int $obLevel)

Handle a view exception.

Parameters

Exception $e
int $obLevel

Return Value

void

in ViewMaker at line 271
protected array gatherViewData($data)

Get the data bound to the view instance.

Parameters

$data

Return Value

array

in AssetMaker at line 15
flushAssets()

No description

in AssetMaker at line 30
string getAssetPath(string $fileName, string $assetPath = null)

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.

Parameters

string $fileName

File to load.

string $assetPath

Explicitly define an asset path.

Return Value

string

Relative path to the asset file.

in AssetMaker at line 55
addMeta($meta)

No description

Parameters

$meta

in AssetMaker at line 60
addJs($href, $attributes = null)

No description

Parameters

$href
$attributes

in AssetMaker at line 65
addCss($href, $attributes = null)

No description

Parameters

$href
$attributes

in ConfigMaker at line 27
array loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)

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

Parameters

array $configFile
array $requiredConfig
null $index

Return Value

array

in ConfigMaker at line 46
array makeConfig(string|array $configFile, array $requiredConfig = [])

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

Parameters

string|array $configFile
array $requiredConfig

Return Value

array

Exceptions

SystemException

in ConfigMaker at line 97
array mergeConfig($configLeft, $configRight)

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

Parameters

$configLeft
$configRight

Return Value

array

The config array

in ConfigMaker at line 116
string getConfigPath(string $fileName, mixed $configPath = null)

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

string $fileName

File to load.

mixed $configPath

Explicitly define a config path.

Return Value

string

Full path to the config file.

in ConfigMaker at line 154
string guessConfigPath(string $suffix = '')

Guess the package path for the called class.

Parameters

string $suffix

An extra path to attach to the end

Return Value

string

in ConfigMaker at line 169
string guessConfigPathFrom(string $class, string $suffix = '')

Guess the package path from a specified class.

Parameters

string $class

Class to guess path from.

string $suffix

An extra path to attach to the end

Return Value

string

in EventEmitter at line 36
EventEmitter bindEvent(string $event, callable $callback, int $priority = 0)

Create a new event binding.

Parameters

string $event

The event name to listen for

callable $callback

The callback to call when emitted

int $priority

Return Value

EventEmitter

in EventEmitter at line 52
EventEmitter bindEventOnce(string $event, callable $callback)

Create a new event binding that fires once only

Parameters

string $event

The event name

callable $callback

Return Value

EventEmitter

in EventEmitter at line 66
protected void emitterEventSortEvents(string $eventName)

Sort the listeners for a given event by priority.

Parameters

string $eventName

Return Value

void

in EventEmitter at line 84
EventEmitter unbindEvent(string $event = null)

Destroys an event binding.

Parameters

string $event

Event to destroy

Return Value

EventEmitter

in EventEmitter at line 124
string|array fireEvent(string $event, array $params = [], bool $halt = false)

Fire an event and call the listeners.

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

string|array

Collection of event results / Or single result (if halted)

in EventEmitter at line 178
mixed fireSystemEvent(string $event, array $params = [], bool $halt = true)

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

Is equivalent to:

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

Event::fire('admin.form.myEvent', [$this, 'myvalue'], true);

Parameters

string $event

Event name

array $params

Event parameters

bool $halt

Halt after first non-null result

Return Value

mixed

protected isLocationAware($config)

No description

Parameters

$config

protected locationApplyScope($query)

Apply location scope where required

Parameters

$query

at line 115
void initialize()

Initialize the widget called by the constructor.

Return Value

void

at line 172
string render(array $options = [])

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

array $options

Return Value

string

HTML markup supplied by this widget.

at line 145
void bindToController()

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.

Return Value

void

in BaseWidget at line 120
protected void fillFromConfig(array $properties = null)

Transfers config values stored inside the $config property directly on to the root object properties.

Parameters

array $properties

Return Value

void

in BaseWidget at line 140
string getId(string $suffix = null)

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

Parameters

string $suffix

An extra string to append to the ID.

Return Value

string

A unique identifier.

in BaseWidget at line 162
string getEventHandler(string $name)

Returns a fully qualified event handler name for this widget.

Parameters

string $name

The ajax event handler name.

Return Value

string

in BaseWidget at line 170
getController()

Returns the controller using this widget.

in BaseWidget at line 181
setConfig(array $config, array $required = [])

Sets the widget configuration values

Parameters

array $config
array $required

Required config items

in BaseWidget at line 194
mixed getConfig(string $name = null, mixed $default = null)

Get the widget configuration values.

Parameters

string $name

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

mixed $default

Default value if nothing is found

Return Value

mixed

at line 151
void loadAssets()

Adds widget specific asset files.

use $this->addCss or $this->addJs

Return Value

void

in FormModelWidget at line 18
createFormModel()

No description

in FormModelWidget at line 34
Model findFormModel($recordId)

No description

Parameters

$recordId

Return Value

Model

Exceptions

ApplicationException

in FormModelWidget at line 62
array resolveModelAttribute(string $attribute = null)

Returns the final model and attribute name of a nested HTML array attribute.

Eg: list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);

Parameters

string $attribute .

Return Value

array

in FormModelWidget at line 80
protected Relation getRelationModel()

Returns the model of a relation type.

Return Value

Relation

Exceptions

Exception

in FormModelWidget at line 94
protected getRelationObject()

No description

in FormModelWidget at line 108
protected getRelationType()

No description

in FormModelWidget at line 115
protected prepareModelsToSave($model, $saveData)

No description

Parameters

$model
$saveData

in FormModelWidget at line 132
protected void setModelAttributes(Model $model, array $saveData)

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

Parameters

Model $model

Model to save to

array $saveData

Data to save.

Return Value

void

at line 225
bool|string renderField(string|array $field, array $options = [])

Renders a single form field Options:

  • useContainer: Wrap the result in a container, used by AJAX. Default: true

Parameters

string|array $field

The field name or definition

array $options

Return Value

bool|string

The rendered partial contents, or false if suppressing an exception

Exceptions

Exception

at line 255
string|bool renderFieldElement(BaseFormWidget $field)

Renders the HTML element for a field

Parameters

BaseFormWidget $field

Return Value

string|bool

The rendered partial contents, or false if suppressing an exception

at line 270
protected void prepareVars()

Prepares the form data

Return Value

void

at line 287
array setFormValues(array $data = null)

Sets or resets form field values.

Parameters

array $data

Return Value

array

at line 311
array onRefresh()

Event handler for refreshing the form.

Return Value

array

at line 360
void addFields(array $fields, string $addToArea = null)

Programmatically add fields, used internally and for extensibility.

Parameters

array $fields
string $addToArea

Return Value

void

at line 398
void addTabFields(array $fields)

Add tab fields.

Parameters

array $fields

Return Value

void

at line 410
bool removeField(string $name)

Programmatically remove a field.

Parameters

string $name

Return Value

bool

at line 431
removeTab(string $name)

Programmatically remove all fields belonging to a tab.

Parameters

string $name

at line 449
FormField makeFormField(string $name, array $config)

Creates a form field object from name and configuration.

Parameters

string $name
array $config

Return Value

FormField

Exceptions

Exception

at line 517
BaseFormWidget|null makeFormFieldWidget(FormField $field)

Makes a widget object from a form field object.

Parameters

FormField $field

Return Value

BaseFormWidget|null

Exceptions

Exception

at line 561
array getFormWidgets()

Get all the loaded form widgets for the instance.

Return Value

array

at line 573
mixed getFormWidget(string $field)

Get a specified form widget

Parameters

string $field

Return Value

mixed

at line 586
array getFields()

Get all the registered fields for the instance.

Return Value

array

at line 598
mixed getField(string $field)

Get a specified field object

Parameters

string $field

Return Value

mixed

at line 611
getTabs()

Get all tab objects for the instance.

at line 624
mixed getTab(string $tab)

Get a specified tab object.

Options: outside, primary, secondary.

Parameters

string $tab

Return Value

mixed

at line 640
array getFieldName(string $field)

Parses a field's name

Parameters

string $field

Field name

Return Value

array

[columnName, context]

at line 657
string getFieldValue(mixed $field)

Looks up the field value.

Parameters

mixed $field

Return Value

string

Exceptions

Exception

at line 686
string getFieldDepends(FormField $field)

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

Parameters

FormField $field

Return Value

string

at line 706
bool showFieldLabels(FormField $field)

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

Parameters

FormField $field

Return Value

bool

at line 723
array getSaveData()

Returns post data from a submitted form.

Return Value

array

at line 772
setActiveTab($tab)

No description

Parameters

$tab

at line 777
getActiveTab()

No description

at line 796
getCookieKey()

No description

at line 805
Route|mixed|string getSessionKey()

Returns the active session key.

Return Value

Route|mixed|string

at line 822
string getContext()

Returns the active context for displaying the form.

Return Value

string

at line 832
protected mixed validateModel()

Validate the supplied form model.

Return Value

mixed

Exceptions

Exception

at line 850
protected void defineFormFields()

Creates a flat array of form fields from the configuration.

Also slots fields in to their respective tabs.

Return Value

void

at line 927
protected void processAutoSpan($fields)

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

Parameters

$fields

Return Value

void

at line 952
protected bool isFormWidget(string $fieldType)

Check if a field type is a widget or not

Parameters

string $fieldType

Return Value

bool

at line 978
protected applyFiltersFromModel()

Allow the model to filter fields.

at line 994
protected mixed getOptionsFromModel(FormField $field, $fieldOptions)

Looks at the model for defined options.

Parameters

FormField $field
$fieldOptions

Return Value

mixed

Exceptions

Exception

at line 1040
protected bool objectMethodExists(object $object, string $method)

Internal helper for method existence checks.

Parameters

object $object
string $method

Return Value

bool

at line 1058
protected array|string dataArrayGet(array $array, array $parts, null $default = null)

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

Parameters

array $array
array $parts
null $default

Return Value

array|string

at line 1093
protected array|string dataArraySet(array $array, array $parts, string $value)

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

Parameters

array $array
array $parts
string $value

Return Value

array|string

at line 1114
protected getSourceData()

No description