mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Fix issue processwire/processwire-issues#1808
This commit is contained in:
@@ -1754,6 +1754,29 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule, Fieldt
|
||||
return $pagefiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after field renamed
|
||||
*
|
||||
* @param Field $field
|
||||
* @param string $prevName Previous name (current name can be found in $field->name)
|
||||
*
|
||||
*/
|
||||
public function ___renamedField(Field $field, $prevName) {
|
||||
// if there is a custom-fields template, rename it
|
||||
$templates = $this->wire()->templates;
|
||||
if($templates->get("field-$field->name")) return;
|
||||
if($templates->get("field-x-$field->name")) return;
|
||||
$template = $templates->get("field-$prevName");
|
||||
if($template) {
|
||||
$templates->rename($template, "field-$field->name");
|
||||
} else {
|
||||
$template = $templates->get("field-x-$prevName");
|
||||
if($template) {
|
||||
$templates->rename($template, "field-x-$field->name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Field config
|
||||
*
|
||||
|
Reference in New Issue
Block a user