1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00

Add custom __debugInfo() methods to Pagefile, Pageimage, and Pagefiles per processwire/processwire-issues#575 plus some other minor updates to Pagefile/Pageimage

This commit is contained in:
Ryan Cramer
2018-04-27 09:55:31 -04:00
parent c2324f0a8a
commit 904db74f1a
3 changed files with 170 additions and 26 deletions

View File

@@ -38,7 +38,7 @@
* Typically a Pagefiles object will be associated with a specific field attached to a Page.
* There may be multiple instances of Pagefiles attached to a given Page (depending on what fields are in it's fieldgroup).
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* ProcessWire 3.x, Copyright 2018 by Ryan Cramer
* https://processwire.com
*
*
@@ -905,5 +905,29 @@ class Pagefiles extends WireArray implements PageFieldValueInterface {
return $this->formatted;
}
/**
* Debug info
*
* @return array
*
*/
public function __debugInfo() {
$info = array(
'count' => $this->count(),
'page' => $this->page ? $this->page->path() : '?',
'field' => $this->field ? $this->field->name : '?',
'url' => $this->url(),
'path' => $this->path(),
'items' => array(),
);
foreach($this as $key => $pagefile) {
/** @var Pagefile $pagefile */
$info['items'][$key] = $pagefile->__debugInfo();
}
return $info;
}
}