ENHANCEMENT ArrayList and DataList now show a nice view of the items inside when using Debug::show()

This commit is contained in:
Sean Harvey 2011-12-17 12:45:45 +13:00
parent 2271566c6a
commit 30f049bd26
2 changed files with 18 additions and 0 deletions

View File

@ -33,6 +33,15 @@ class ArrayList extends ViewableData implements SS_List {
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() {
$result = array();

View File

@ -152,6 +152,15 @@ class DataList extends ViewableData implements SS_List {
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') {
return new SS_Map($this, $keyField, $titleField);
}