Skip to content

Commit

Permalink
Merge pull request #334 from cakephp/issue-forms
Browse files Browse the repository at this point in the history
Handle form instances specifically.
  • Loading branch information
lorenzo committed May 10, 2015
2 parents e32cdd0 + a05d32e commit f9f615c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Panel/VariablesPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ public function shutdown(Event $event)
if ($item instanceof Query) {
$item = $item->all();
}
// Handle forms specifically until they implement __debugInfo
if ($item instanceof Form) {
$item = [
'form class' => get_class($item),
'errors' => $item->errors()
];
}
if ($item instanceof Closure ||
$item instanceof PDO ||
$item instanceof SimpleXmlElement
Expand All @@ -88,6 +95,9 @@ public function shutdown(Event $event)
$item->getLine()
);
}
if (is_object($item) && method_exists($item, '__debugInfo')) {
$item = $item->__debugInfo();
}
return $item;
});

Expand Down

0 comments on commit f9f615c

Please sign in to comment.