mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
feat(ListDecorator): Add setList() function. Useful for keeping a decorator/paginated list configuration intact while modifying the underlying list.
This commit is contained in:
parent
733511565e
commit
c7586c68b7
@ -15,8 +15,7 @@ abstract class SS_ListDecorator extends ViewableData implements SS_List, SS_Sort
|
|||||||
protected $list;
|
protected $list;
|
||||||
|
|
||||||
public function __construct(SS_List $list) {
|
public function __construct(SS_List $list) {
|
||||||
$this->list = $list;
|
$this->setList($list);
|
||||||
$this->failover = $this->list;
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
@ -30,6 +29,21 @@ abstract class SS_ListDecorator extends ViewableData implements SS_List, SS_Sort
|
|||||||
return $this->list;
|
return $this->list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the list this decorator wraps around.
|
||||||
|
*
|
||||||
|
* Useful for keeping a decorator/paginated list configuration intact while modifying
|
||||||
|
* the underlying list.
|
||||||
|
*
|
||||||
|
* @return SS_List
|
||||||
|
*/
|
||||||
|
public function setList(SS_List $list)
|
||||||
|
{
|
||||||
|
$this->list = $list;
|
||||||
|
$this->failover = $this->list;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
// PROXIED METHODS ---------------------------------------------------------
|
// PROXIED METHODS ---------------------------------------------------------
|
||||||
|
|
||||||
public function offsetExists($key) {
|
public function offsetExists($key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user