@@ -619,13 +619,13 @@ private function getFieldArray(Page $p, $f) {
619619 || $ f ->type == "FieldtypeFieldsetClose " ) return false ;
620620
621621 if ($ f ->type instanceof FieldtypeRepeater) {
622- if (count ($ p ->$ f )) {
622+ if (is_object ( $ p -> $ f ) && count ($ p ->$ f )) {
623623 $ fieldArray = array ();
624624 foreach ($ p ->$ f as $ o ) $ fieldArray [$ o ->id ] = $ o ->getIterator ();
625625 }
626626 }
627627 elseif ($ f ->type instanceof FieldtypePage) {
628- if (count ($ p ->$ f )) {
628+ if (is_object ( $ p -> $ f ) && count ($ p ->$ f )) {
629629 $ fieldArray = array ();
630630 if ($ p ->$ f instanceof PageArray) {
631631 foreach ($ p ->$ f as $ o ) $ fieldArray [$ o ->id ] = $ o ->getIterator ();
@@ -652,27 +652,48 @@ private function getFieldArray(Page $p, $f) {
652652
653653
654654 private function imageDetails ($ p , $ f ) {
655- if (!$ f ->type instanceof FieldtypeImage) return ;
656655 $ of = $ p ->of ();
657656 $ p ->of (false );
658657 $ imageStr = '' ;
659658 $ imagePreview = '' ;
660659 if (\TracyDebugger::getDataValue ('imagesInFieldListValues ' )) {
661660 $ inputfield = $ f ->getInputfield ($ p );
662661 }
663- foreach ($ p ->$ f as $ image ) {
664- if (isset ($ inputfield ) && $ inputfield ) {
665- $ thumb = $ inputfield ->getAdminThumb ($ image );
666- $ thumb = $ thumb ['thumb ' ];
667- $ imagePreview = '<a class="pw-modal" href=" ' .$ image ->url .'"><img width="125" src=" ' .$ thumb ->url .'" /></a><br /> ' ;
662+ if ($ f ->type instanceof FieldtypePage || $ f ->type instanceof FieldtypeRepeater) {
663+ if (is_object ($ p ->$ f ) && count ($ p ->$ f )) {
664+ // $subpage is referenced page or repeater item
665+ foreach ($ p ->$ f as $ subpage ) {
666+ foreach ($ subpage as $ field => $ item ) {
667+ $ f = $ this ->wire ('fields ' )->get ($ field );
668+ if ($ item && $ f && $ f ->type instanceof FieldTypeImage) {
669+ foreach ($ item as $ image ) {
670+ $ imageStr .= $ this ->imageStr ($ f ->getInputfield ($ p ), $ image );
671+ }
672+ }
673+ }
674+ }
675+ }
676+ }
677+ elseif ($ f ->type instanceof FieldtypeImage) {
678+ foreach ($ p ->$ f as $ image ) {
679+ $ imageStr .= $ this ->imageStr ($ inputfield , $ image );
668680 }
669- $ imageStr .= '<p> ' .$ image ->name .'<br /> ' .$ imagePreview .'width: ' .$ image ->width .'<br />height: ' .$ image ->height .'<br />size: ' .$ image ->filesizeStr .'</p><br /> ' ;
670681 }
671682 $ p ->of ($ of );
672683 return $ imageStr ;
673684 }
674685
675686
687+ private function imageStr ($ inputfield , $ image ) {
688+ if (isset ($ inputfield ) && $ inputfield ) {
689+ $ thumb = $ inputfield ->getAdminThumb ($ image );
690+ $ thumb = $ thumb ['thumb ' ];
691+ $ imagePreview = '<a class="pw-modal" href=" ' .$ image ->url .'"><img width="125" src=" ' .$ thumb ->url .'" /></a><br /> ' ;
692+ }
693+ return '<p> ' .$ image ->name .'<br /> ' .$ imagePreview .'width: ' .$ image ->width .'<br />height: ' .$ image ->height .'<br />size: ' .$ image ->filesizeStr .'</p><br /> ' ;
694+ }
695+
696+
676697 private function getLanguageVersion ($ p , $ fieldName , $ lang , $ showDefault = false ) {
677698 if ($ this ->wire ('languages ' )) {
678699 $ p ->of (false );
0 commit comments