mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 20:11:46 +02:00
Fix issue processwire/processwire-issues#1253
This commit is contained in:
@@ -203,19 +203,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$renderValueMode && $this->value instanceof Pageimages) {
|
if(!$renderValueMode && $this->value instanceof Pageimages) {
|
||||||
$page = $this->hasPage;
|
$page = $this->getRootHasPage();
|
||||||
if(!$page || !$page->id) {
|
|
||||||
$process = $this->wire('process');
|
|
||||||
if($process instanceof WirePageEditor) {
|
|
||||||
$page = $process->getPage();
|
|
||||||
} else {
|
|
||||||
$page = new NullPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(wireClassExists('RepeaterPage')) {
|
|
||||||
/** @var RepeaterPage $page */
|
|
||||||
while(wireInstanceOf($page, 'RepeaterPage')) $page = $page->getForPage();
|
|
||||||
}
|
|
||||||
if($page->id && $this->wire('user')->hasPermission('page-edit-images', $page)) {
|
if($page->id && $this->wire('user')->hasPermission('page-edit-images', $page)) {
|
||||||
$modules->get('JqueryUI')->use('modal');
|
$modules->get('JqueryUI')->use('modal');
|
||||||
} else {
|
} else {
|
||||||
@@ -1243,6 +1231,24 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
return $tooltip;
|
return $tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the root "hasPage" being edited
|
||||||
|
*
|
||||||
|
* @return NullPage|Page
|
||||||
|
* @since 3.0.168
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function getRootHasPage() {
|
||||||
|
$page = $this->hasPage;
|
||||||
|
if(!$page || !$page->id) {
|
||||||
|
$process = $this->wire()->process;
|
||||||
|
$page = $process instanceof WirePageEditor ? $process->getPage() : new NullPage();
|
||||||
|
}
|
||||||
|
if(wireClassExists('RepeaterPage')) { /** @var RepeaterPage $page */
|
||||||
|
while(wireInstanceOf($page, 'RepeaterPage')) $page = $page->getForPage();
|
||||||
|
}
|
||||||
|
return $page;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build data for the tooltip that appears above the thumbnails
|
* Build data for the tooltip that appears above the thumbnails
|
||||||
@@ -1311,7 +1317,7 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
|
|||||||
|
|
||||||
/** @var Sanitizer $sanitizer */
|
/** @var Sanitizer $sanitizer */
|
||||||
$sanitizer = $this->wire('sanitizer');
|
$sanitizer = $this->wire('sanitizer');
|
||||||
$page = $this->hasPage;
|
$page = $this->getRootHasPage();
|
||||||
|
|
||||||
if($page && $page->id) {
|
if($page && $page->id) {
|
||||||
if(!$this->wire()->user->hasPermission('page-edit-images', $page)) $this->useImageEditor = 0;
|
if(!$this->wire()->user->hasPermission('page-edit-images', $page)) $this->useImageEditor = 0;
|
||||||
|
Reference in New Issue
Block a user