1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-22 14:23:05 +02:00
This commit is contained in:
Ryan Cramer
2020-07-27 16:38:53 -04:00
parent 7391f48c28
commit ff1d63c0d4
3 changed files with 32 additions and 11 deletions

View File

@@ -333,14 +333,14 @@ class FieldtypeFieldsetOpen extends Fieldtype {
// avoid ending up in infinite loop, since FieldtypeFieldsetClose extends this
if($this instanceof FieldtypeFieldsetClose) return;
// rename the _END field to match this one
$fields = $this->wire('fields');
$fields = $this->wire()->fields;
$oldName = $prevName . self::fieldsetCloseIdentifier;
$newName = $field->name . self::fieldsetCloseIdentifier;
$closer = $this->getFieldsetCloseField($field);
if(!$closer) {
$closer = $fields->get($prevName . self::fieldsetCloseIdentifier);
if($closer) {
$closer->name = $field->name . self::fieldsetCloseIdentifier;
$fields->save($closer);
}
if(!$closer) $closer = $fields->get($oldName);
if($closer && $closer->name != $newName) {
$closer->name = $newName;
$fields->save($closer);
}
parent::___renamedField($field, $prevName);
}