mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 00:06:55 +02:00
Fix issue processwire/processwire-issues#1542
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||
* https://processwire.com
|
||||
*
|
||||
* @method Fieldgroup clone(Saveable $item, $name = '')
|
||||
* @method int saveContext(Fieldgroup $fieldgroup)
|
||||
* @method array getExportData(Fieldgroup $fieldgroup)
|
||||
* @method array setImportData(Fieldgroup $fieldgroup, array $data)
|
||||
|
@@ -380,7 +380,7 @@ class Templates extends WireSaveableItems {
|
||||
|
||||
if($fieldgroup->name == $item->name) {
|
||||
// if the fieldgroup and the item have the same name, we'll also clone the fieldgroup
|
||||
$fieldgroup = $this->wire('fieldgroups')->clone($fieldgroup, $name);
|
||||
$fieldgroup = $this->wire()->fieldgroups->clone($fieldgroup, $name);
|
||||
$item->fieldgroup = $fieldgroup;
|
||||
}
|
||||
|
||||
@@ -388,10 +388,13 @@ class Templates extends WireSaveableItems {
|
||||
|
||||
if($item && $item->id && !$item->altFilename) {
|
||||
// now that we have a clone, lets also clone the template file, if it exists
|
||||
$path = $this->wire('config')->paths->templates;
|
||||
$file = $path . $item->name . '.' . $this->wire('config')->templateExtension;
|
||||
if($original->filenameExists() && is_writable($path) && !file_exists($file)) {
|
||||
if(copy($original->filename, $file)) $item->filename = $file;
|
||||
$config = $this->wire()->config;
|
||||
$files = $this->wire()->files;
|
||||
$path = $config->paths->templates;
|
||||
$ext = $config->templateExtension ? $config->templateExtension : 'php';
|
||||
$file = "$path$item->name.$ext";
|
||||
if($original->filenameExists() && is_writable($path) && !$files->exists($file)) {
|
||||
if($files->copy($original->filename, $file)) $item->filename = $file;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user