mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 12:10:45 +02:00
Attempt fix for processwire/processwire-issues#1600
This commit is contained in:
@@ -1397,13 +1397,31 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
|
|||||||
}
|
}
|
||||||
|
|
||||||
$context = '';
|
$context = '';
|
||||||
|
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;
|
$process = $this->wire()->process;
|
||||||
if($item && $process instanceof WirePageEditor) {
|
if($item && $process instanceof WirePageEditor) {
|
||||||
$contextPage = $process->getPage();
|
$contextPage = $process->getPage();
|
||||||
if(wireInstanceOf($contextPage, 'RepeaterPage')) {
|
if(wireInstanceOf($contextPage, 'RepeaterPage') && strpos($this->name, '_repeater') === false) {
|
||||||
|
// @var RepeaterPage $contextPage
|
||||||
|
$forPage = $contextPage->getForPage();
|
||||||
|
if($forPage->id) $contextPage = $forPage;
|
||||||
$context = "repeater{$contextPage->id}_";
|
$context = "repeater{$contextPage->id}_";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @var Page $page */
|
/** @var Page $page */
|
||||||
$page = $pagefiles->getFieldsPage();
|
$page = $pagefiles->getFieldsPage();
|
||||||
|
Reference in New Issue
Block a user