mirror of
https://github.com/processwire/processwire.git
synced 2025-08-13 18:24:57 +02:00
Attempt fix for processwire/processwire-issues#1600
This commit is contained in:
@@ -1397,14 +1397,32 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
|
||||
}
|
||||
|
||||
$context = '';
|
||||
$process = $this->wire()->process;
|
||||
if($item && $process instanceof WirePageEditor) {
|
||||
$contextPage = $process->getPage();
|
||||
if(wireInstanceOf($contextPage, 'RepeaterPage')) {
|
||||
$context = "repeater{$contextPage->id}_";
|
||||
if($item) {
|
||||
$hasPage = $this->hasPage;
|
||||
if($hasPage && wireInstanceOf($hasPage, 'RepeaterPage')) {
|
||||
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
|
||||
$context = "repeater{$hasPage->id}_";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The following does not work with nested repeaters, fixed by the above, but kept here for reference
|
||||
$process = $this->wire()->process;
|
||||
if($item && $process instanceof WirePageEditor) {
|
||||
$contextPage = $process->getPage();
|
||||
if(wireInstanceOf($contextPage, 'RepeaterPage') && strpos($this->name, '_repeater') === false) {
|
||||
// @var RepeaterPage $contextPage
|
||||
$forPage = $contextPage->getForPage();
|
||||
if($forPage->id) $contextPage = $forPage;
|
||||
$context = "repeater{$contextPage->id}_";
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/** @var Page $page */
|
||||
$page = $pagefiles->getFieldsPage();
|
||||
$id = $item ? ('_' . $this->pagefileId($item, $context)) : '';
|
||||
|
Reference in New Issue
Block a user