class ListController extends ControllerAction

List Controller Class

Traits

Widget Maker Trait Class

Extension trait

Properties

string $configPath from  ConfigMaker
protected $configFileExtension from  ConfigMaker
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
static protected array $extensionCallbacks from  ExtensionTrait
static string $extendableStaticCalledClass from  ExtensionTrait
protected $extensionHidden from  ExtensionTrait
protected Controller $controller from  ControllerAction
protected array $config from  ControllerAction
protected $requiredProperties
protected string $primaryAlias
array $listConfig

Define controller list configuration array.

protected Lists[] $listWidgets
protected Toolbar[] $toolbarWidgets
protected Filter[] $filterWidgets
protected array $requiredConfig

Methods

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.

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.

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.

static void
extensionExtendCallback(callable $callback)

Helper method for ::extend() static method

extensionHideField($name)

No description

extensionHideMethod($name)

No description

extensionIsHiddenField($name)

No description

extensionIsHiddenMethod($name)

No description

static 
getCalledExtensionClass()

No description

__construct(Controller $controller)

List_Controller constructor.

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

Sets the widget configuration values

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

Get the widget configuration values.

hideAction($methodName)

Protects a public method from being available as an controller method.

void
listExtendColumns(Lists $host)

Called after the list columns are defined.

listExtendModel(Model $model, null $alias = null)

Controller override: Extend supplied model

listExtendQueryBefore(Builder $query, $alias = null)

Controller override: Extend the query used for populating the list before the default query is processed.

listExtendQuery(Builder $query, $alias = null)

Controller override: Extend the query used for populating the list after the default query is processed.

listExtendRecords(LengthAwarePaginator|Collection $records, $alias = null)

listExtendRecords controller override: Extend the records used for populating the list after the query is processed.

listFilterExtendQuery(Builder $query, array $scope)

Controller override: Extend the query used for populating the filter options before the default query is processed.

void
listFilterExtendScopesBefore(Filter $host)

Called before the filter scopes are defined.

void
listFilterExtendScopes(Filter $host, $scopes)

Called after the filter scopes are defined.

string
listOverrideColumnValue(Model $record, string $column, string $alias = null)

Replace a table column value (...)

string
listOverrideHeaderValue(string $columnName, string $alias = null)

Replace the entire table header contents (...) with custom HTML

static void
extendListColumns(callable $callback)

Static helper for extending list columns.

index()

No description

index_onDelete()

No description

array
makeLists()

Creates all the widgets based on the model config.

makeList($alias)

Prepare the widgets used by this action

renderList($alias = null)

No description

refreshList($alias = null)

No description

getListWidget(string $alias = null)

Returns the widget used by this behavior.

getListConfig(null $alias = null)

Returns the configuration used by this behavior.

Details

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 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 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 ExtensionTrait at line 32
extensionApplyInitCallbacks()

No description

in ExtensionTrait at line 51
static void extensionExtendCallback(callable $callback)

Helper method for ::extend() static method

Parameters

callable $callback

Return Value

void

in ExtensionTrait at line 64
protected extensionHideField($name)

No description

Parameters

$name

in ExtensionTrait at line 69
protected extensionHideMethod($name)

No description

Parameters

$name

in ExtensionTrait at line 74
extensionIsHiddenField($name)

No description

Parameters

$name

in ExtensionTrait at line 79
extensionIsHiddenMethod($name)

No description

Parameters

$name

in ExtensionTrait at line 84
static getCalledExtensionClass()

No description

at line 69
__construct(Controller $controller)

List_Controller constructor.

Parameters

Controller $controller

Exceptions

Exception

in ControllerAction at line 65
setConfig(string|array $config, array $required = [])

Sets the widget configuration values

Parameters

string|array $config
array $required

Required config items

in ControllerAction at line 78
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

in ControllerAction at line 103
protected hideAction($methodName)

Protects a public method from being available as an controller method.

Parameters

$methodName

in ListExtendable at line 17
void listExtendColumns(Lists $host)

Called after the list columns are defined.

Parameters

Lists $host

The hosting list widget

Return Value

void

in ListExtendable at line 29
listExtendModel(Model $model, null $alias = null)

Controller override: Extend supplied model

Parameters

Model $model
null $alias

in ListExtendable at line 40
listExtendQueryBefore(Builder $query, $alias = null)

Controller override: Extend the query used for populating the list before the default query is processed.

Parameters

Builder $query
$alias

in ListExtendable at line 50
listExtendQuery(Builder $query, $alias = null)

Controller override: Extend the query used for populating the list after the default query is processed.

Parameters

Builder $query
$alias

in ListExtendable at line 59
listExtendRecords(LengthAwarePaginator|Collection $records, $alias = null)

listExtendRecords controller override: Extend the records used for populating the list after the query is processed.

Parameters

LengthAwarePaginator|Collection $records
$alias

in ListExtendable at line 70
listFilterExtendQuery(Builder $query, array $scope)

Controller override: Extend the query used for populating the filter options before the default query is processed.

Parameters

Builder $query
array $scope

in ListExtendable at line 81
void listFilterExtendScopesBefore(Filter $host)

Called before the filter scopes are defined.

Parameters

Filter $host

The hosting filter widget

Return Value

void

in ListExtendable at line 93
void listFilterExtendScopes(Filter $host, $scopes)

Called after the filter scopes are defined.

Parameters

Filter $host

The hosting filter widget

$scopes

Return Value

void

in ListExtendable at line 106
string listOverrideColumnValue(Model $record, string $column, string $alias = null)

Replace a table column value (...)

Parameters

Model $record

The populated model used for the column

string $column

The column to override

string $alias

List alias (optional)

Return Value

string

HTML view

in ListExtendable at line 118
string listOverrideHeaderValue(string $columnName, string $alias = null)

Replace the entire table header contents (...) with custom HTML

Parameters

string $columnName

The column name to override

string $alias

List alias (optional)

Return Value

string

HTML view

in ListExtendable at line 129
static void extendListColumns(callable $callback)

Static helper for extending list columns.

Parameters

callable $callback

Return Value

void

at line 94
index()

No description

at line 103
index_onDelete()

No description

at line 148
array makeLists()

Creates all the widgets based on the model config.

Return Value

array

List of Admin\Classes\BaseWidget objects

at line 166
BaseWidget makeList($alias)

Prepare the widgets used by this action

Parameters

$alias

Return Value

BaseWidget

at line 272
renderList($alias = null)

No description

Parameters

$alias

at line 292
refreshList($alias = null)

No description

Parameters

$alias

at line 312
BaseWidget getListWidget(string $alias = null)

Returns the widget used by this behavior.

Parameters

string $alias

Return Value

BaseWidget

at line 328
BaseWidget getListConfig(null $alias = null)

Returns the configuration used by this behavior.

Parameters

null $alias

Return Value

BaseWidget