Backend\Behaviors\ListController

Source: ~/modules/backend/behaviors/ListController.php

Extends:

Adds features for working with backend lists.

This behavior is implemented in the controller like so:

public $implement = [
    'Backend.Behaviors.ListController',
];

public $listConfig = 'config_list.yaml';

The $listConfig property makes reference to the list configuration values as either a YAML file, located in the controller view directory, or directly as a PHP array.

Public properties

There are no public properties in the class.

Show inherited public properties

Inherited public properties

Protected properties

protected array $listDefinitions

List definitions, keys for alias and value for configuration.

protected string $primaryDefinition

The primary list alias to use. Default: list

protected array $listConfig

List configuration, keys for alias and value for config objects.

protected Backend\Classes\WidgetBase $listWidgets

Reference to the list widget object.

protected Backend\Classes\WidgetBase $toolbarWidgets

Reference to the toolbar widget objects.

protected Backend\Classes\WidgetBase $filterWidgets

Reference to the filter widget objects.

protected $requiredProperties

Properties that must exist in the controller using this behavior.

protected array $requiredConfig

Configuration values that must exist when applying the primary config file.

  • modelClass: Class name for the model
  • list: List column definitions

Show inherited protected properties

Inherited protected properties

Public methods

public void __construct(Backend\Classes\Controller $controller)

Behavior constructor

Parameters

public static void extendListColumns(callable $callback)

Static helper for extending list columns.

Parameters
  • callable $callback

public static void extendListFilterScopes(callable $callback)

Static helper for extending filter scopes.

Parameters
  • callable $callback

public void index()

Index Controller action.

public void index_onDelete()

Bulk delete records.

public void listExtendColumns(Backend\Widgets\List $host)

Called after the list columns are defined.

Parameters
  • Backend\Widgets\List $host - The hosting list widget

public Model listExtendModel(Model $model, $definition=NULL)

Controller override: Extend supplied model

Parameters
  • Model $model
  • $definition

public void listExtendQuery(October\Rain\Database\Builder $query, $definition=NULL)

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

Parameters

public void listExtendQueryBefore(October\Rain\Database\Builder $query, $definition=NULL)

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

Parameters

public void listExtendRecords(Illuminate\Contracts\Pagination\LengthAwarePaginator|Illuminate\Database\Eloquent\Collection $records, $definition=NULL)

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

Parameters
  • Illuminate\Contracts\Pagination\LengthAwarePaginator|Illuminate\Database\Eloquent\Collection $records
  • $definition

public void listFilterExtendQuery(October\Rain\Database\Builder $query, array $scope)

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

Parameters

public void listFilterExtendScopes(Backend\Widgets\Filter $host)

Called after the filter scopes are defined.

Parameters

public Backend\Classes\WidgetBase listGetConfig($definition=NULL)

Returns the configuration used by this behavior.

Parameters
  • $definition

public Backend\Classes\WidgetBase listGetWidget($definition=NULL)

Returns the widget used by this behavior.

Parameters
  • $definition

public string listInjectRowClass(Model $record, string $definition=NULL)

Returns a CSS class name for a list row ().

Parameters
  • Model $record - The populated model used for the column
  • string $definition - List definition (optional)

public string listMakePartial(string $partial, array $params=array())

Controller accessor for making partials within this behavior.

Parameters
  • string $partial
  • array $params

public string listOverrideColumnValue(Model $record, string $columnName, string $definition=NULL)

Replace a table column value (...)

Parameters
  • Model $record - The populated model used for the column
  • string $columnName - The column name to override
  • string $definition - List definition (optional)

public string listOverrideHeaderValue(string $columnName, string $definition=NULL)

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

Parameters
  • string $columnName - The column name to override
  • string $definition - List definition (optional)

public array listRefresh(string $definition=NULL)

Refreshes the list container only, useful for returning in custom AJAX requests.

Parameters
  • string $definition - Optional list definition.

public string listRender(string $definition=NULL)

Renders the widget collection.

Parameters
  • string $definition - Optional list definition.

public void makeList($definition=NULL)

Prepare the widgets used by this action

Parameters
  • $definition

public array makeLists()

Creates all the list widgets based on the definitions.

Show inherited public methods

Inherited public methods

Protected methods

Show inherited protected methods

Inherited protected methods