Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ENHANCEMENT ArrayList and DataList now show a nice view of the items …

…inside when using Debug::show()
  • Loading branch information...
commit 30f049bd26386ee79844c643dcf10a54461b957f 1 parent 2271566
@halkyon halkyon authored
Showing with 18 additions and 0 deletions.
  1. +9 −0 model/ArrayList.php
  2. +9 −0 model/DataList.php
View
9 model/ArrayList.php
@@ -33,6 +33,15 @@ public function toArray() {
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
9 model/DataList.php
@@ -152,6 +152,15 @@ public function toNestedArray() {
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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.