From 30b34c70b32a89c5843b9921063ef163de3ca246 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 6 Feb 2025 10:31:22 -0500 Subject: [PATCH] Fix issue processwire/processwire-issues#2025 --- .../Inputfield/InputfieldFile/InputfieldFile.module | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module index 611d9a10..8ad60691 100644 --- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module +++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module @@ -30,7 +30,7 @@ * @method string renderList($value) * @method string renderUpload($value) * @method void fileAdded(Pagefile $pagefile) - * @method array extractMetadata(Pagefile $pagefile, array $metadata = array()) + * @method array extractMetadata(Pagefile $pagefile, array $metadata = []) Given a Pagefile return array of meta data pulled from it * @method Pagefile|null processInputAddFile($filename) * @method void processInputDeleteFile(Pagefile $pagefile) * @method bool processInputFile(WireInputData $input, Pagefile $pagefile, $n) @@ -929,7 +929,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel * @return array Associative array of meta data (i.e. description and tags) * */ - protected function ___extractMetadata(Pagefile $pagefile, array $metadata = array()) { + protected function ___extractMetadata(Pagefile $pagefile, array $metadata = []) { $languages = $this->wire()->languages; @@ -1507,7 +1507,11 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel if($item) { $hasPage = $this->hasPage; if($hasPage && wireInstanceOf($hasPage, 'RepeaterPage')) { - if(strpos($this->name, '_repeater') === false) { + $process = $this->wire()->process; + if($process instanceof WirePageEditor && $process->getPage()->id === $hasPage->id) { + // repeater page being edited directly or in front-end modal + // so no '_repeater' suffix is necessary here + } else if(strpos($this->name, '_repeater') === false) { // ensures that custom fields are properly namespaced within repeater // though note that this prevents it from working when editing a repeater // page directly, independently of its forPage