mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1116 from sunnysideup/patch-10
MINOR: typo in DataList
This commit is contained in:
commit
397729bf49
@ -411,15 +411,14 @@ class DataList extends ViewableData implements SS_List, SS_Filterable, SS_Sortab
|
|||||||
* The function will be passed each record of the DataList in turn, and must return true for the record to be
|
* The function will be passed each record of the DataList in turn, and must return true for the record to be
|
||||||
* included. Returns the filtered list.
|
* included. Returns the filtered list.
|
||||||
*
|
*
|
||||||
* Note that, in the current implementation, the filtered list will be an ArrayList, but this may change in a
|
* @return ArrayList (this may change in future implementations)
|
||||||
* future implementation.
|
|
||||||
*/
|
*/
|
||||||
public function filterByCallback($callback) {
|
public function filterByCallback($callback) {
|
||||||
if(!is_callable($callback)) {
|
if(!is_callable($callback)) {
|
||||||
throw new LogicException("DataList::filterByCallback() must be passed something callable.");
|
throw new LogicException("DataList::filterByCallback() must be passed something callable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = new ArrayList;
|
$output = new ArrayList();
|
||||||
foreach($this as $item) {
|
foreach($this as $item) {
|
||||||
if($callback($item)) $output->push($item);
|
if($callback($item)) $output->push($item);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user