Skip to content

Commit 30649fe

Browse files
committed
Improve handling of images in referenced pages in Request Info panel.
1 parent 9029ba9 commit 30649fe

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

TracyDebugger.module

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TracyDebugger extends WireData implements Module, ConfigurableModule {
3232
'summary' => __('Tracy debugger from Nette with several PW specific custom tools.', __FILE__),
3333
'author' => 'Adrian Jones',
3434
'href' => 'https://processwire.com/talk/topic/12208-tracy-debugger/',
35-
'version' => '4.10.15',
35+
'version' => '4.10.16',
3636
'autoload' => true,
3737
'singular' => true,
3838
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',

panels/RequestInfoPanel.php

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -659,21 +659,23 @@ private function imageDetails($p, $f) {
659659
if(\TracyDebugger::getDataValue('imagesInFieldListValues')) {
660660
$inputfield = $f->getInputfield($p);
661661
}
662-
if($f->type instanceof FieldtypePage || $f->type instanceof FieldtypeRepeater) {
662+
if($f->type instanceof FieldtypeRepeater) {
663663
if(is_object($p->$f) && count($p->$f)) {
664-
// $subpage is referenced page or repeater item
665664
foreach($p->$f as $subpage) {
666-
$subpage_of = $subpage->of();
667-
$subpage->of(false);
668-
foreach($subpage as $field => $item) {
669-
$f = $this->wire('fields')->get($field);
670-
if($item && $f && $f->type instanceof FieldTypeImage) {
671-
foreach($item as $image) {
672-
$imageStr .= $this->imageStr($f->getInputfield($p), $image);
673-
}
674-
}
665+
$imageStr .= $this->getImages($subpage);
666+
}
667+
}
668+
}
669+
elseif($f->type instanceof FieldtypePage) {
670+
if(is_object($p->$f)) {
671+
$fieldArray = array();
672+
if($p->$f instanceof PageArray) {
673+
foreach($p->$f as $subpage) {
674+
$imageStr .= $this->getImages($subpage);
675675
}
676-
$subpage->of($subpage_of);
676+
}
677+
else {
678+
$imageStr .= $this->getImages($p->$f);
677679
}
678680
}
679681
}
@@ -687,6 +689,24 @@ private function imageDetails($p, $f) {
687689
}
688690

689691

692+
private function getImages($p) {
693+
$p_of = $p->of();
694+
$p->of(false);
695+
$imageStr = '';
696+
foreach($p as $field => $item) {
697+
$f = $this->wire('fields')->get($field);
698+
if($item && $f && $f->type instanceof FieldTypeImage) {
699+
foreach($item as $image) {
700+
$imageStr .= $this->imageStr($f->getInputfield($p), $image);
701+
}
702+
}
703+
}
704+
$p->of($p_of);
705+
706+
return $imageStr;
707+
}
708+
709+
690710
private function imageStr($inputfield, $image) {
691711
if(isset($inputfield) && $inputfield) {
692712
$thumb = $inputfield->getAdminThumb($image);

0 commit comments

Comments
 (0)