mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT ArrayList and DataList now show a nice view of the items inside when using Debug::show()
This commit is contained in:
parent
2271566c6a
commit
30f049bd26
@ -33,6 +33,15 @@ class ArrayList extends ViewableData implements SS_List {
|
|||||||
return $this->items;
|
return $this->items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function debug() {
|
||||||
|
$val = "<h2>" . $this->class . "</h2><ul>";
|
||||||
|
foreach($this->toNestedArray() as $item) {
|
||||||
|
$val .= "<li style=\"list-style-type: disc; margin-left: 20px\">" . Debug::text($item) . "</li>";
|
||||||
|
}
|
||||||
|
$val .= "</ul>";
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
public function toNestedArray() {
|
public function toNestedArray() {
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
|
@ -152,6 +152,15 @@ class DataList extends ViewableData implements SS_List {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function debug() {
|
||||||
|
$val = "<h2>" . $this->class . "</h2><ul>";
|
||||||
|
foreach($this->toNestedArray() as $item) {
|
||||||
|
$val .= "<li style=\"list-style-type: disc; margin-left: 20px\">" . Debug::text($item) . "</li>";
|
||||||
|
}
|
||||||
|
$val .= "</ul>";
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
public function map($keyField = 'ID', $titleField = 'Title') {
|
public function map($keyField = 'ID', $titleField = 'Title') {
|
||||||
return new SS_Map($this, $keyField, $titleField);
|
return new SS_Map($this, $keyField, $titleField);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user