1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00

Update InputfieldImage and ProcessPageEditImageSelect to recognize version in URLs

This commit is contained in:
Ryan Cramer
2023-12-15 13:38:40 -05:00
parent 019d5c6014
commit 99a1d0f81d
2 changed files with 12 additions and 3 deletions

View File

@@ -1138,11 +1138,15 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
*
*/
protected function getVariationUrl($pagefile, $id) {
$page = $pagefile->page;
$pageId = $page->id;
$version = (int) ((string) $page->get('_version'));
return $this->wire()->config->urls->admin . "page/image/variations/" .
"?id={$pagefile->page->id}" .
"?id=$pageId" .
"&file=$pagefile->name" .
"&modal=1" .
"&varcnt=varcnt_$id";
"&varcnt=varcnt_$id" .
"&version=$version";
}
/**
@@ -1166,11 +1170,13 @@ class InputfieldImage extends InputfieldFile implements InputfieldItemList, Inpu
*/
protected function getEditUrl(Pagefile $pagefile, $pageID) {
$name = $this->editFieldName ? $this->editFieldName : $this->name;
$version = (int) ((string) $pagefile->page->get('_version'));
return $this->wire()->config->urls->admin . "page/image/edit/" .
"?id=$pageID" .
"&file=$pageID,$pagefile->name" .
"&rte=0" .
"&field=$name";
"&field=$name" .
"&version=$version";
}
/**

View File

@@ -694,6 +694,9 @@ class ProcessPageEditImageSelect extends Process implements ConfigurableModule {
$file = basename($file);
$id = isset($parts['id']) ? (int) $parts['id'] : $this->page->id;
$version = isset($parts['version']) ? (int) $parts['version'] : (int) $input->get('version');
if($version > 0) $parts['version'] = $version;
if(!isset($parts['modal'])) $parts['modal'] = 1;
if(!isset($parts['edit_page_id']) && $this->editorPage) $parts['edit_page_id'] = $this->editorPage->id;
if(!isset($parts['hidpi'])) $parts['hidpi'] = (int) $this->hidpi;