mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Make available to extends Lists records
This commit is contained in:
parent
076f5199af
commit
f5f7ed08e4
@ -157,6 +157,10 @@ class ListController extends ControllerBehavior
|
||||
$this->controller->listExtendQuery($query, $definition);
|
||||
});
|
||||
|
||||
$widget->bindEvent('list.extendRecords', function ($records) use ($definition) {
|
||||
$this->controller->listExtendRecords($records, $definition);
|
||||
});
|
||||
|
||||
$widget->bindEvent('list.injectRowClass', function ($record) use ($definition) {
|
||||
return $this->controller->listInjectRowClass($record, $definition);
|
||||
});
|
||||
@ -423,7 +427,16 @@ class ListController extends ControllerBehavior
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller override: Extend the query used for populating the filter
|
||||
* 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
|
||||
*/
|
||||
public function listExtendRecords($records, $definition = null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller override: Extend the query used for populating the filter
|
||||
* options before the default query is processed.
|
||||
* @param October\Rain\Database\Builder $query
|
||||
* @param array $scope
|
||||
|
@ -504,6 +504,16 @@ class Lists extends WidgetBase
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Extensibility
|
||||
*/
|
||||
if (
|
||||
($event = $this->fireEvent('list.extendRecords', [$records], true)) ||
|
||||
($event = Event::fire('backend.list.extendRecords', [$this, $records], true))
|
||||
) {
|
||||
$records = $event;
|
||||
}
|
||||
|
||||
return $this->records = $records;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user