ListController adds features for working with backend lists

This behavior is implemented in the controller like so:

public $implement = [

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.

See Also

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

protected array $listDefinitions

listDefinitions are keys for alias and value for configuration.

protected string $primaryDefinition

primaryDefinition list alias to use. Default: list

protected array $listConfig

listConfig are keys for alias and value for config objects.

protected Backend\Classes\WidgetBase[] $listWidgets

listWidgets reference to the list widget object.

protected Backend\Classes\WidgetBase[] $toolbarWidgets

toolbarWidgets reference to the toolbar widget objects.

protected Backend\Classes\WidgetBase[] $filterWidgets

filterWidgets reference to the filter widget objects.

protected array $requiredProperties

requiredProperties in the controller

protected array $requiredConfig

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

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

protected array $actions

actions visible in context of the controller

Show inherited protected properties

Inherited Protected Properties

Public Methods

public __construct()

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

__construct the behavior

public static extendListColumns()

public static extendListColumns($callback): void

extendListColumns is a static helper for extending list columns.

public static extendListFilterScopes()

public static extendListFilterScopes($callback): void

extendListFilterScopes is a static helper for extending filter scopes.

public index()

public index(): void 

index controller action

public index_onDelete()

public index_onDelete(): void 

index_onDelete bulk deletes records.

public listAfterReorder()

public listAfterReorder(
    October\Rain\Database\Model $record,
    string|null $definition = null
): void

listAfterReorder is called after the list record structure is reordered

public listExtendColumns()

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

listExtendColumns is called after the list columns are defined.

public listExtendModel()

public listExtendModel(Model $model, $definition = null): Model 

listExtendModel controller override: Extend supplied model

public listExtendQuery()

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

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

public listExtendQueryBefore()

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

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

public listExtendRecords()

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

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

public listExtendRefreshResults()

public listExtendRefreshResults(
    Backend\Widgets\List $host,
    array $result,
    string $definition = null
): array 

listExtendRefreshResults is called when the list is refreshed using AJAX, and should return an array of additional partial updates.

public listExtendSortColumn()

public listExtendSortColumn(
    October\Rain\Database\Builder $query,
    $definition = null
): void

listExtendSortColumn controller override: Customize the sort column and direction to include secondary sorting columns if necessary

public listFilterExtendQuery()

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

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

public listFilterExtendScopes()

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

listFilterExtendScopes is called after the filter scopes are defined.

public listGetConfig()

public listGetConfig($definition = null): object|null 

listGetConfig returns the configuration used by this behavior. You may override this method in your controller as an alternative to defining a listConfig property.

public listGetFilterWidget()

public listGetFilterWidget($definition = null): Backend\Classes\WidgetBase 

listGetFilterWidget returns the filter widget used by this behavior.

public listGetId()

public listGetId(string $suffix = null, $definition = null): string 

listGetId returns a unique ID for the list widget used by this behavior. This is useful for dealing with identifiers in the markup.

<div id="<?= $this->listGetId()">...</div>

A suffix may be used passed as the first argument to reuse the identifier in other areas.

<button id="<?= $this->listGetId('button')">...</button>

public listGetToolbarWidget()

public listGetToolbarWidget($definition = null): Backend\Classes\WidgetBase 

listGetToolbarWidget returns the toolbar widget used by this behavior.

public listGetWidget()

public listGetWidget($definition = null): Backend\Classes\WidgetBase 

listGetWidget returns the widget used by this behavior.

public listInjectRowClass()

public listInjectRowClass(
    Model $record,
    string $definition = null
): string 

listInjectRowClass returns a CSS class name for a list row ().

public listMakePartial()

public listMakePartial(string $partial, array $params = []): string 

listMakePartial is a controller accessor for making partials within this behavior.

public listOverrideColumnValue()

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

listOverrideColumnValue replaces a table column value (...)

public listOverrideHeaderValue()

public listOverrideHeaderValue(
    string $columnName,
    string $definition = null
): string 

listOverrideHeaderValue replaces the entire table header contents (...) with custom HTML

public listOverrideRecordUrl()

public listOverrideRecordUrl(
    October\Rain\Database\Model $record,
    string|null $definition = null
): string|array|void 

listOverrideRecordUrl overrides the record url for the given record

public listRefresh()

public listRefresh(string $definition = null): array 

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

public listRender()

public listRender(string $definition = null): string 

listRender renders the widget collection.

public makeList()

public makeList($definition = null): Backend\Classes\WidgetBase 

makeList prepares the widgets used by this action

public makeLists()

public makeLists(): array 

makeLists creates all the list widgets based on the definitions.

Show inherited public methods

Inherited Public Methods

Protected Methods

protected createModel()

protected createModel(): October\Rain\Database\Model 

createModel is an internal method used to prepare the list model object.

protected listCanDeleteRecords()

protected listCanDeleteRecords(): bool 

listCanDeleteRecords determines if records can be deleted from the list

protected makeListStructureConfig()

protected makeListStructureConfig($widgetConfig, $config): object|null 

Show inherited protected methods

Inherited Protected Methods