Merge pull request #131 from halkyon/master

Nice debug formatting for ArrayList and DataList
This commit is contained in:
Sam Minnée 2011-12-16 18:05:09 -08:00
commit 99b2430565
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);
}