Fix docbocks ListController behaviour. (#4989)
* Fix docbocks ListController behaviour.
This commit is contained in:
parent
39980d8346
commit
3450921c26
|
|
@ -42,17 +42,17 @@ class ListController extends ControllerBehavior
|
|||
protected $listConfig = [];
|
||||
|
||||
/**
|
||||
* @var \Backend\Classes\WidgetBase Reference to the list widget object.
|
||||
* @var \Backend\Classes\WidgetBase[] Reference to the list widget object.
|
||||
*/
|
||||
protected $listWidgets = [];
|
||||
|
||||
/**
|
||||
* @var \Backend\Classes\WidgetBase Reference to the toolbar widget objects.
|
||||
* @var \Backend\Classes\WidgetBase[] Reference to the toolbar widget objects.
|
||||
*/
|
||||
protected $toolbarWidgets = [];
|
||||
|
||||
/**
|
||||
* @var \Backend\Classes\WidgetBase Reference to the filter widget objects.
|
||||
* @var \Backend\Classes\WidgetBase[] Reference to the filter widget objects.
|
||||
*/
|
||||
protected $filterWidgets = [];
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ class ListController extends ControllerBehavior
|
|||
|
||||
/**
|
||||
* Prepare the widgets used by this action
|
||||
* @return void
|
||||
* @return \Backend\Widgets\Lists
|
||||
*/
|
||||
public function makeList($definition = null)
|
||||
{
|
||||
|
|
@ -165,7 +165,7 @@ class ListController extends ControllerBehavior
|
|||
/*
|
||||
* List Widget with extensibility
|
||||
*/
|
||||
$widget = $this->makeWidget('Backend\Widgets\Lists', $columnConfig);
|
||||
$widget = $this->makeWidget(\Backend\Widgets\Lists::class, $columnConfig);
|
||||
|
||||
$widget->bindEvent('list.extendColumns', function () use ($widget) {
|
||||
$this->controller->listExtendColumns($widget);
|
||||
|
|
@ -203,7 +203,7 @@ class ListController extends ControllerBehavior
|
|||
if (isset($listConfig->toolbar)) {
|
||||
$toolbarConfig = $this->makeConfig($listConfig->toolbar);
|
||||
$toolbarConfig->alias = $widget->alias . 'Toolbar';
|
||||
$toolbarWidget = $this->makeWidget('Backend\Widgets\Toolbar', $toolbarConfig);
|
||||
$toolbarWidget = $this->makeWidget(\Backend\Widgets\Toolbar::class, $toolbarConfig);
|
||||
$toolbarWidget->bindToController();
|
||||
$toolbarWidget->cssClasses[] = 'list-header';
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ class ListController extends ControllerBehavior
|
|||
|
||||
$filterConfig = $this->makeConfig($listConfig->filter);
|
||||
$filterConfig->alias = $widget->alias . 'Filter';
|
||||
$filterWidget = $this->makeWidget('Backend\Widgets\Filter', $filterConfig);
|
||||
$filterWidget = $this->makeWidget(\Backend\Widgets\Filter::class, $filterConfig);
|
||||
$filterWidget->bindToController();
|
||||
|
||||
/*
|
||||
|
|
@ -286,6 +286,7 @@ class ListController extends ControllerBehavior
|
|||
/**
|
||||
* Bulk delete records.
|
||||
* @return void
|
||||
* @throws \October\Rain\Exception\ApplicationException when the parent definition is missing.
|
||||
*/
|
||||
public function index_onDelete()
|
||||
{
|
||||
|
|
@ -353,6 +354,7 @@ class ListController extends ControllerBehavior
|
|||
* Renders the widget collection.
|
||||
* @param string $definition Optional list definition.
|
||||
* @return string Rendered HTML for the list.
|
||||
* @throws \October\Rain\Exception\ApplicationException when there are no list widgets set.
|
||||
*/
|
||||
public function listRender($definition = null)
|
||||
{
|
||||
|
|
@ -455,7 +457,7 @@ class ListController extends ControllerBehavior
|
|||
|
||||
/**
|
||||
* Called after the list columns are defined.
|
||||
* @param \Backend\Widgets\List $host The hosting list widget
|
||||
* @param \Backend\Widgets\Lists $host The hosting list widget
|
||||
* @return void
|
||||
*/
|
||||
public function listExtendColumns($host)
|
||||
|
|
@ -473,8 +475,9 @@ class ListController extends ControllerBehavior
|
|||
|
||||
/**
|
||||
* Controller override: Extend supplied model
|
||||
* @param Model $model
|
||||
* @return Model
|
||||
* @param \October\Rain\Database\Model $model
|
||||
* @param string|null $definition
|
||||
* @return \October\Rain\Database\Model
|
||||
*/
|
||||
public function listExtendModel($model, $definition = null)
|
||||
{
|
||||
|
|
@ -485,6 +488,7 @@ class ListController extends ControllerBehavior
|
|||
* Controller override: Extend the query used for populating the list
|
||||
* before the default query is processed.
|
||||
* @param \October\Rain\Database\Builder $query
|
||||
* @param string|null $definition
|
||||
*/
|
||||
public function listExtendQueryBefore($query, $definition = null)
|
||||
{
|
||||
|
|
@ -494,6 +498,7 @@ class ListController extends ControllerBehavior
|
|||
* Controller override: Extend the query used for populating the list
|
||||
* after the default query is processed.
|
||||
* @param \October\Rain\Database\Builder $query
|
||||
* @param string|null $definition
|
||||
*/
|
||||
public function listExtendQuery($query, $definition = null)
|
||||
{
|
||||
|
|
@ -502,7 +507,8 @@ class ListController extends ControllerBehavior
|
|||
/**
|
||||
* Controller override: Extend the records used for populating the list
|
||||
* after the query is processed.
|
||||
* @param Illuminate\Contracts\Pagination\LengthAwarePaginator|Illuminate\Database\Eloquent\Collection $records
|
||||
* @param \Illuminate\Contracts\Pagination\LengthAwarePaginator|\Illuminate\Database\Eloquent\Collection $records
|
||||
* @param string|null $definition
|
||||
*/
|
||||
public function listExtendRecords($records, $definition = null)
|
||||
{
|
||||
|
|
@ -520,9 +526,9 @@ class ListController extends ControllerBehavior
|
|||
|
||||
/**
|
||||
* Returns a CSS class name for a list row (<tr class="...">).
|
||||
* @param Model $record The populated model used for the column
|
||||
* @param string $definition List definition (optional)
|
||||
* @return string CSS class name
|
||||
* @param \October\Rain\Database\Model $record The populated model used for the column
|
||||
* @param string|null $definition List definition (optional)
|
||||
* @return string|void CSS class name
|
||||
*/
|
||||
public function listInjectRowClass($record, $definition = null)
|
||||
{
|
||||
|
|
@ -530,10 +536,10 @@ class ListController extends ControllerBehavior
|
|||
|
||||
/**
|
||||
* Replace a table column value (<td>...</td>)
|
||||
* @param Model $record The populated model used for the column
|
||||
* @param \October\Rain\Database\Model $record The populated model used for the column
|
||||
* @param string $columnName The column name to override
|
||||
* @param string $definition List definition (optional)
|
||||
* @return string HTML view
|
||||
* @param string|null $definition List definition (optional)
|
||||
* @return string|void HTML view
|
||||
*/
|
||||
public function listOverrideColumnValue($record, $columnName, $definition = null)
|
||||
{
|
||||
|
|
@ -542,8 +548,8 @@ class ListController extends ControllerBehavior
|
|||
/**
|
||||
* Replace the entire table header contents (<th>...</th>) with custom HTML
|
||||
* @param string $columnName The column name to override
|
||||
* @param string $definition List definition (optional)
|
||||
* @return string HTML view
|
||||
* @param string|null $definition List definition (optional)
|
||||
* @return string|void HTML view
|
||||
*/
|
||||
public function listOverrideHeaderValue($columnName, $definition = null)
|
||||
{
|
||||
|
|
@ -557,7 +563,7 @@ class ListController extends ControllerBehavior
|
|||
public static function extendListColumns($callback)
|
||||
{
|
||||
$calledClass = self::getCalledExtensionClass();
|
||||
Event::listen('backend.list.extendColumns', function ($widget) use ($calledClass, $callback) {
|
||||
Event::listen('backend.list.extendColumns', function (\Backend\Widgets\Lists $widget) use ($calledClass, $callback) {
|
||||
if (!is_a($widget->getController(), $calledClass)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -565,7 +571,7 @@ class ListController extends ControllerBehavior
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Static helper for extending filter scopes.
|
||||
* @param callable $callback
|
||||
* @return void
|
||||
|
|
@ -573,7 +579,7 @@ class ListController extends ControllerBehavior
|
|||
public static function extendListFilterScopes($callback)
|
||||
{
|
||||
$calledClass = self::getCalledExtensionClass();
|
||||
Event::listen('backend.filter.extendScopes', function ($widget) use ($calledClass, $callback) {
|
||||
Event::listen('backend.filter.extendScopes', function (\Backend\Widgets\Filter $widget) use ($calledClass, $callback) {
|
||||
if (!is_a($widget->getController(), $calledClass)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ trait WidgetMaker
|
|||
* Makes a widget object with the supplied configuration file.
|
||||
* @param string $class Widget class name
|
||||
* @param array $widgetConfig An array of config.
|
||||
* @return \Backend\Classes\WidgetBase The widget object
|
||||
* @return mixed|\Backend\Classes\WidgetBase The widget object
|
||||
*/
|
||||
public function makeWidget($class, $widgetConfig = [])
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue